[clang] [libc++] Fixed uniform_real_distribution.h where it was allowing initialization with non floating point types (PR #70485)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 11:34:57 PDT 2023


================
@@ -27,6 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template<class _RealType = double>
 class _LIBCPP_TEMPLATE_VIS uniform_real_distribution
 {
+     static_assert(std::is_floating_point<_RealType>::value, "result_type must be a floating point type");
----------------
philnik777 wrote:

This needs a test. You can take a look at `libcxx/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp` for an example of how to check static assertions.

https://github.com/llvm/llvm-project/pull/70485


More information about the cfe-commits mailing list