Commit 0cded43d by Jonathan Wakely Committed by Jonathan Wakely

PR libstdc++/41759 reword static assertions in <random>

	PR libstdc++/41759
	* include/bits/random.h: Reword static assertion messages to state
	positive conditions.
	* include/bits/random.tcc: Likewise.
	* include/bits/uniform_int_dist.h: Likewise.
	* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
	patterns.

From-SVN: r235160
parent fa519ca6
2016-04-18 Jonathan Wakely <jwakely@redhat.com> 2016-04-18 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/41759
* include/bits/random.h: Reword static assertion messages to state
positive conditions.
* include/bits/random.tcc: Likewise.
* include/bits/uniform_int_dist.h: Likewise.
* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
patterns.
* include/std/function (_Bind, _Bind_result): Remove unused typedefs. * include/std/function (_Bind, _Bind_result): Remove unused typedefs.
* config/cpu/sh/atomicity.h: Fix typo in comment. * config/cpu/sh/atomicity.h: Fix typo in comment.
......
...@@ -158,7 +158,7 @@ _GLIBCXX_END_NAMESPACE_VERSION ...@@ -158,7 +158,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
struct _Adaptor struct _Adaptor
{ {
static_assert(std::is_floating_point<_DInputType>::value, static_assert(std::is_floating_point<_DInputType>::value,
"template argument not a floating point type"); "template argument must be a floating point type");
public: public:
_Adaptor(_Engine& __g) _Adaptor(_Engine& __g)
...@@ -235,8 +235,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -235,8 +235,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class linear_congruential_engine class linear_congruential_engine
{ {
static_assert(std::is_unsigned<_UIntType>::value, "template argument " static_assert(std::is_unsigned<_UIntType>::value,
"substituting _UIntType not an unsigned integral type"); "result_type must be an unsigned integral type");
static_assert(__m == 0u || (__a < __m && __c < __m), static_assert(__m == 0u || (__a < __m && __c < __m),
"template argument substituting __m out of bounds"); "template argument substituting __m out of bounds");
...@@ -443,8 +443,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -443,8 +443,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_UIntType __c, size_t __l, _UIntType __f> _UIntType __c, size_t __l, _UIntType __f>
class mersenne_twister_engine class mersenne_twister_engine
{ {
static_assert(std::is_unsigned<_UIntType>::value, "template argument " static_assert(std::is_unsigned<_UIntType>::value,
"substituting _UIntType not an unsigned integral type"); "result_type must be an unsigned integral type");
static_assert(1u <= __m && __m <= __n, static_assert(1u <= __m && __m <= __n,
"template argument substituting __m out of bounds"); "template argument substituting __m out of bounds");
static_assert(__r <= __w, "template argument substituting " static_assert(__r <= __w, "template argument substituting "
...@@ -658,10 +658,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -658,10 +658,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _UIntType, size_t __w, size_t __s, size_t __r>
class subtract_with_carry_engine class subtract_with_carry_engine
{ {
static_assert(std::is_unsigned<_UIntType>::value, "template argument " static_assert(std::is_unsigned<_UIntType>::value,
"substituting _UIntType not an unsigned integral type"); "result_type must be an unsigned integral type");
static_assert(0u < __s && __s < __r, static_assert(0u < __s && __s < __r,
"template argument substituting __s out of bounds"); "0 < s < r");
static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits, static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits,
"template argument substituting __w out of bounds"); "template argument substituting __w out of bounds");
...@@ -1065,8 +1065,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1065,8 +1065,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _RandomNumberEngine, size_t __w, typename _UIntType> template<typename _RandomNumberEngine, size_t __w, typename _UIntType>
class independent_bits_engine class independent_bits_engine
{ {
static_assert(std::is_unsigned<_UIntType>::value, "template argument " static_assert(std::is_unsigned<_UIntType>::value,
"substituting _UIntType not an unsigned integral type"); "result_type must be an unsigned integral type");
static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits, static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits,
"template argument substituting __w out of bounds"); "template argument substituting __w out of bounds");
...@@ -1278,7 +1278,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1278,7 +1278,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/** /**
* @brief Produces random numbers by combining random numbers from some * @brief Produces random numbers by combining random numbers from some
* base engine to produce random numbers with a specifies number of bits * base engine to produce random numbers with a specifies number of bits
* @p __w. * @p __k.
*/ */
template<typename _RandomNumberEngine, size_t __k> template<typename _RandomNumberEngine, size_t __k>
class shuffle_order_engine class shuffle_order_engine
...@@ -1649,7 +1649,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1649,7 +1649,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @{ * @{
*/ */
// std::uniform_int_distribution is defined in <bits/random_uid.h> // std::uniform_int_distribution is defined in <bits/uniform_int_dist.h>
/** /**
* @brief Return true if two uniform integer distributions have * @brief Return true if two uniform integer distributions have
...@@ -1702,7 +1702,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1702,7 +1702,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class uniform_real_distribution class uniform_real_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -1920,7 +1920,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1920,7 +1920,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class normal_distribution class normal_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -2133,7 +2133,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2133,7 +2133,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class lognormal_distribution class lognormal_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -2337,7 +2337,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2337,7 +2337,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class gamma_distribution class gamma_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -2554,7 +2554,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2554,7 +2554,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class chi_squared_distribution class chi_squared_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -2764,7 +2764,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2764,7 +2764,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class cauchy_distribution class cauchy_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -2965,7 +2965,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2965,7 +2965,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class fisher_f_distribution class fisher_f_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -3189,7 +3189,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3189,7 +3189,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class student_t_distribution class student_t_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -3612,7 +3612,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3612,7 +3612,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class binomial_distribution class binomial_distribution
{ {
static_assert(std::is_integral<_IntType>::value, static_assert(std::is_integral<_IntType>::value,
"template argument not an integral type"); "result_type must be an integral type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -3843,7 +3843,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3843,7 +3843,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class geometric_distribution class geometric_distribution
{ {
static_assert(std::is_integral<_IntType>::value, static_assert(std::is_integral<_IntType>::value,
"template argument not an integral type"); "result_type must be an integral type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -4043,7 +4043,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -4043,7 +4043,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class negative_binomial_distribution class negative_binomial_distribution
{ {
static_assert(std::is_integral<_IntType>::value, static_assert(std::is_integral<_IntType>::value,
"template argument not an integral type"); "result_type must be an integral type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -4265,7 +4265,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -4265,7 +4265,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class poisson_distribution class poisson_distribution
{ {
static_assert(std::is_integral<_IntType>::value, static_assert(std::is_integral<_IntType>::value,
"template argument not an integral type"); "result_type must be an integral type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -4481,7 +4481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -4481,7 +4481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class exponential_distribution class exponential_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -4683,7 +4683,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -4683,7 +4683,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class weibull_distribution class weibull_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -4886,7 +4886,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -4886,7 +4886,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class extreme_value_distribution class extreme_value_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -5086,7 +5086,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -5086,7 +5086,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class discrete_distribution class discrete_distribution
{ {
static_assert(std::is_integral<_IntType>::value, static_assert(std::is_integral<_IntType>::value,
"template argument not an integral type"); "result_type must be an integral type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -5316,7 +5316,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -5316,7 +5316,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class piecewise_constant_distribution class piecewise_constant_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
...@@ -5583,7 +5583,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -5583,7 +5583,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class piecewise_linear_distribution class piecewise_linear_distribution
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "result_type must be a floating point type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
......
...@@ -3312,7 +3312,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -3312,7 +3312,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
generate_canonical(_UniformRandomNumberGenerator& __urng) generate_canonical(_UniformRandomNumberGenerator& __urng)
{ {
static_assert(std::is_floating_point<_RealType>::value, static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type"); "template argument must be a floating point type");
const size_t __b const size_t __b
= std::min(static_cast<size_t>(std::numeric_limits<_RealType>::digits), = std::min(static_cast<size_t>(std::numeric_limits<_RealType>::digits),
......
...@@ -58,7 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -58,7 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class uniform_int_distribution class uniform_int_distribution
{ {
static_assert(std::is_integral<_IntType>::value, static_assert(std::is_integral<_IntType>::value,
"template argument not an integral type"); "template argument must be an integral type");
public: public:
/** The type of the range of the distribution. */ /** The type of the range of the distribution. */
......
...@@ -10,6 +10,6 @@ std::__detail::_Adaptor<std::mt19937, unsigned long> aurng(urng); ...@@ -10,6 +10,6 @@ std::__detail::_Adaptor<std::mt19937, unsigned long> aurng(urng);
auto x = std::generate_canonical<std::size_t, auto x = std::generate_canonical<std::size_t,
std::numeric_limits<std::size_t>::digits>(urng); std::numeric_limits<std::size_t>::digits>(urng);
// { dg-error "static assertion failed: template argument not a floating point type" "" { target *-*-* } 160 } // { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 160 }
// { dg-error "static assertion failed: template argument not a floating point type" "" { target *-*-* } 3314 } // { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 3314 }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment