From 0cded43df4e04799722b0595b4d31cd85bd29920 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 18 Apr 2016 19:03:50 +0100 Subject: [PATCH] PR libstdc++/41759 reword static assertions in 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 --- libstdc++-v3/ChangeLog | 8 +++ libstdc++-v3/include/bits/random.h | 60 +++++++++---------- libstdc++-v3/include/bits/random.tcc | 2 +- libstdc++-v3/include/bits/uniform_int_dist.h | 2 +- .../26_numerics/random/pr60037-neg.cc | 4 +- 5 files changed, 42 insertions(+), 34 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index cb1e7a1520f..4dfe22bd932 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,13 @@ 2016-04-18 Jonathan Wakely + 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. * config/cpu/sh/atomicity.h: Fix typo in comment. diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index 1babe809165..d5182dcede3 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -158,7 +158,7 @@ _GLIBCXX_END_NAMESPACE_VERSION struct _Adaptor { static_assert(std::is_floating_point<_DInputType>::value, - "template argument not a floating point type"); + "template argument must be a floating point type"); public: _Adaptor(_Engine& __g) @@ -235,8 +235,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template class linear_congruential_engine { - static_assert(std::is_unsigned<_UIntType>::value, "template argument " - "substituting _UIntType not an unsigned integral type"); + static_assert(std::is_unsigned<_UIntType>::value, + "result_type must be an unsigned integral type"); static_assert(__m == 0u || (__a < __m && __c < __m), "template argument substituting __m out of bounds"); @@ -443,8 +443,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _UIntType __c, size_t __l, _UIntType __f> class mersenne_twister_engine { - static_assert(std::is_unsigned<_UIntType>::value, "template argument " - "substituting _UIntType not an unsigned integral type"); + static_assert(std::is_unsigned<_UIntType>::value, + "result_type must be an unsigned integral type"); static_assert(1u <= __m && __m <= __n, "template argument substituting __m out of bounds"); static_assert(__r <= __w, "template argument substituting " @@ -658,10 +658,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template class subtract_with_carry_engine { - static_assert(std::is_unsigned<_UIntType>::value, "template argument " - "substituting _UIntType not an unsigned integral type"); + static_assert(std::is_unsigned<_UIntType>::value, + "result_type must be an unsigned integral type"); 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, "template argument substituting __w out of bounds"); @@ -1065,8 +1065,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template class independent_bits_engine { - static_assert(std::is_unsigned<_UIntType>::value, "template argument " - "substituting _UIntType not an unsigned integral type"); + static_assert(std::is_unsigned<_UIntType>::value, + "result_type must be an unsigned integral type"); static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits, "template argument substituting __w out of bounds"); @@ -1278,7 +1278,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Produces random numbers by combining random numbers from some * base engine to produce random numbers with a specifies number of bits - * @p __w. + * @p __k. */ template class shuffle_order_engine @@ -1649,7 +1649,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @{ */ - // std::uniform_int_distribution is defined in + // std::uniform_int_distribution is defined in /** * @brief Return true if two uniform integer distributions have @@ -1702,7 +1702,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class uniform_real_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -1920,7 +1920,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class normal_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -2133,7 +2133,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class lognormal_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -2337,7 +2337,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class gamma_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -2554,7 +2554,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class chi_squared_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -2764,7 +2764,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class cauchy_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -2965,7 +2965,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class fisher_f_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -3189,7 +3189,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class student_t_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -3612,7 +3612,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class binomial_distribution { static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); + "result_type must be an integral type"); public: /** The type of the range of the distribution. */ @@ -3843,7 +3843,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class geometric_distribution { static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); + "result_type must be an integral type"); public: /** The type of the range of the distribution. */ @@ -4043,7 +4043,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class negative_binomial_distribution { static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); + "result_type must be an integral type"); public: /** The type of the range of the distribution. */ @@ -4265,7 +4265,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class poisson_distribution { static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); + "result_type must be an integral type"); public: /** The type of the range of the distribution. */ @@ -4481,7 +4481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class exponential_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -4683,7 +4683,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class weibull_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -4886,7 +4886,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class extreme_value_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -5086,7 +5086,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class discrete_distribution { static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); + "result_type must be an integral type"); public: /** The type of the range of the distribution. */ @@ -5316,7 +5316,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class piecewise_constant_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ @@ -5583,7 +5583,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class piecewise_linear_distribution { static_assert(std::is_floating_point<_RealType>::value, - "template argument not a floating point type"); + "result_type must be a floating point type"); public: /** The type of the range of the distribution. */ diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index 7dfc721e55f..079cb1fc787 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -3312,7 +3312,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION generate_canonical(_UniformRandomNumberGenerator& __urng) { 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 = std::min(static_cast(std::numeric_limits<_RealType>::digits), diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h index 393aa77b7f0..06bc36e4886 100644 --- a/libstdc++-v3/include/bits/uniform_int_dist.h +++ b/libstdc++-v3/include/bits/uniform_int_dist.h @@ -58,7 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class uniform_int_distribution { static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); + "template argument must be an integral type"); public: /** The type of the range of the distribution. */ diff --git a/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc b/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc index e9ebc684732..f0efa4ce5c4 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc @@ -10,6 +10,6 @@ std::__detail::_Adaptor aurng(urng); auto x = std::generate_canonical::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 } -- 2.30.2