+2020-02-15 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/random.h (uniform_random_bit_generator): Require min()
+ and max() to be constant expressions and min() to be less than max().
+ * testsuite/26_numerics/random/concept.cc: Check additional cases.
+ * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lineno.
+
2020-02-13 Patrick Palka <ppalka@redhat.com>
* include/Makefile.am: Add <bits/ranges_uninitialized.h>.
{
{ _Gen::min() } -> same_as<invoke_result_t<_Gen&>>;
{ _Gen::max() } -> same_as<invoke_result_t<_Gen&>>;
+ requires bool_constant<(_Gen::min() < _Gen::max())>::value;
};
#endif
};
static_assert( ! std::uniform_random_bit_generator<N11> );
+
+struct N12
+{
+ unsigned operator()();
+ static unsigned min() { return 0; } // not constexpr
+ static constexpr unsigned max() { return 1; }
+};
+
+static_assert( ! std::uniform_random_bit_generator<N12> ); // LWG 3150
+
+struct N13
+{
+ unsigned operator()();
+ static constexpr unsigned min() { return 0; }
+ static unsigned max() { return 1; } // not constexpr
+};
+
+static_assert( ! std::uniform_random_bit_generator<N13> ); // LWG 3150
+
+struct N14
+{
+ unsigned operator()();
+ static constexpr unsigned min() { return 1; }
+ static constexpr unsigned max() { return 0; } // max not greater than min
+};
+
+static_assert( ! std::uniform_random_bit_generator<N14> ); // LWG 3150
auto x = std::generate_canonical<std::size_t,
std::numeric_limits<std::size_t>::digits>(urng);
-// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 171 }
+// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 172 }
// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 3281 }