[libcxx-commits] [libcxx] [libc++] add floating point type check for uniform real distrubtion (PR #70564)
Nhat Nguyen via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 30 19:07:02 PDT 2023
================
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<_RealType = double>
+// class uniform_real_distribution;
+
+// result_type must be floating type, int type is unsupported
+
+#include <random>
+
+struct test_random : public std::uniform_real_distribution<int> {};
+
+// expected-error-re@*:* {{static assertion failed due to requirement 'std::is_floating_point<int>::value'{{.*}}result_type must be floating type}}
----------------
NhatNguyen1810 wrote:
can you take a quick look with my change? Basically I follow this file to do the regex matcher. I can't find a similar case where it does not use the regex. Let me know what I should put without the regex matcher. Thanks.
https://github.com/llvm/llvm-project/blob/main/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp#L49
Or you can just make a change suggestion without regex which works, I will apply it.
https://github.com/llvm/llvm-project/pull/70564
More information about the libcxx-commits
mailing list