diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -79,13 +79,6 @@ in namespace ``std``, it might be because one of your source files now needs to include one or more of the headers listed above. -- The integer distributions ``binomial_distribution``, ``discrete_distribution``, - ``geometric_distribution``, ``negative_binomial_distribution``, ``poisson_distribution``, - and ``uniform_int_distribution`` now conform to the Standard by rejecting - template parameter types other than ``short``, ``int``, ``long``, ``long long``, - (as an extension) ``__int128_t``, and the unsigned versions thereof. - In particular, ``uniform_int_distribution`` is no longer supported. - - The C++14 function ``std::quoted(const char*)`` is no longer supported in C++03 or C++11 modes. diff --git a/libcxx/include/__random/binomial_distribution.h b/libcxx/include/__random/binomial_distribution.h --- a/libcxx/include/__random/binomial_distribution.h +++ b/libcxx/include/__random/binomial_distribution.h @@ -27,7 +27,6 @@ template class _LIBCPP_TEMPLATE_VIS binomial_distribution { - static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be an integer type larger than char"); public: // types typedef _IntType result_type; diff --git a/libcxx/include/__random/discrete_distribution.h b/libcxx/include/__random/discrete_distribution.h --- a/libcxx/include/__random/discrete_distribution.h +++ b/libcxx/include/__random/discrete_distribution.h @@ -30,7 +30,6 @@ template class _LIBCPP_TEMPLATE_VIS discrete_distribution { - static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be an integer type larger than char"); public: // types typedef _IntType result_type; diff --git a/libcxx/include/__random/geometric_distribution.h b/libcxx/include/__random/geometric_distribution.h --- a/libcxx/include/__random/geometric_distribution.h +++ b/libcxx/include/__random/geometric_distribution.h @@ -10,7 +10,6 @@ #define _LIBCPP___RANDOM_GEOMETRIC_DISTRIBUTION_H #include <__config> -#include <__random/is_valid.h> #include <__random/negative_binomial_distribution.h> #include #include @@ -27,7 +26,6 @@ template class _LIBCPP_TEMPLATE_VIS geometric_distribution { - static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be an integer type larger than char"); public: // types typedef _IntType result_type; diff --git a/libcxx/include/__random/is_valid.h b/libcxx/include/__random/is_valid.h --- a/libcxx/include/__random/is_valid.h +++ b/libcxx/include/__random/is_valid.h @@ -18,27 +18,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// [rand.req.genl]/1.5: -// The effect of instantiating a template that has a template type parameter -// named IntType is undefined unless the corresponding template argument is -// cv-unqualified and is one of short, int, long, long long, unsigned short, -// unsigned int, unsigned long, or unsigned long long. - -template struct __libcpp_random_is_valid_inttype : false_type {}; -template<> struct __libcpp_random_is_valid_inttype : true_type {}; -template<> struct __libcpp_random_is_valid_inttype : true_type {}; -template<> struct __libcpp_random_is_valid_inttype : true_type {}; -template<> struct __libcpp_random_is_valid_inttype : true_type {}; -template<> struct __libcpp_random_is_valid_inttype : true_type {}; -template<> struct __libcpp_random_is_valid_inttype : true_type {}; -template<> struct __libcpp_random_is_valid_inttype : true_type {}; -template<> struct __libcpp_random_is_valid_inttype : true_type {}; - -#ifndef _LIBCPP_HAS_NO_INT128 -template<> struct __libcpp_random_is_valid_inttype<__int128_t> : true_type {}; -template<> struct __libcpp_random_is_valid_inttype<__uint128_t> : true_type {}; -#endif // _LIBCPP_HAS_NO_INT128 - // [rand.req.urng]/3: // A class G meets the uniform random bit generator requirements if G models // uniform_random_bit_generator, invoke_result_t is an unsigned integer type, diff --git a/libcxx/include/__random/negative_binomial_distribution.h b/libcxx/include/__random/negative_binomial_distribution.h --- a/libcxx/include/__random/negative_binomial_distribution.h +++ b/libcxx/include/__random/negative_binomial_distribution.h @@ -29,7 +29,6 @@ template class _LIBCPP_TEMPLATE_VIS negative_binomial_distribution { - static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be an integer type larger than char"); public: // types typedef _IntType result_type; diff --git a/libcxx/include/__random/poisson_distribution.h b/libcxx/include/__random/poisson_distribution.h --- a/libcxx/include/__random/poisson_distribution.h +++ b/libcxx/include/__random/poisson_distribution.h @@ -12,7 +12,6 @@ #include <__config> #include <__random/clamp_to_integral.h> #include <__random/exponential_distribution.h> -#include <__random/is_valid.h> #include <__random/normal_distribution.h> #include <__random/uniform_real_distribution.h> #include @@ -31,7 +30,6 @@ template class _LIBCPP_TEMPLATE_VIS poisson_distribution { - static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be an integer type larger than char"); public: // types typedef _IntType result_type; diff --git a/libcxx/include/__random/uniform_int_distribution.h b/libcxx/include/__random/uniform_int_distribution.h --- a/libcxx/include/__random/uniform_int_distribution.h +++ b/libcxx/include/__random/uniform_int_distribution.h @@ -156,10 +156,9 @@ return _Sp; } -template +template // __int128_t is also supported as an extension here class uniform_int_distribution { - static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be an integer type larger than char"); public: // types typedef _IntType result_type; diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap --- a/libcxx/include/module.modulemap +++ b/libcxx/include/module.modulemap @@ -812,7 +812,6 @@ module geometric_distribution { private header "__random/geometric_distribution.h" } module independent_bits_engine { private header "__random/independent_bits_engine.h" } module is_seed_sequence { private header "__random/is_seed_sequence.h" } - module is_valid { private header "__random/is_valid.h" } module knuth_b { private header "__random/knuth_b.h" } module linear_congruential_engine { private header "__random/linear_congruential_engine.h" } module log2 { private header "__random/log2.h" } diff --git a/libcxx/test/libcxx/numerics/rand/rand.req.urng/valid_int_type.verify.cpp b/libcxx/test/libcxx/numerics/rand/rand.req.urng/valid_int_type.verify.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/numerics/rand/rand.req.urng/valid_int_type.verify.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// - -#include - -void test() -{ - { - std::binomial_distribution baddist; //expected-error@*:* {{IntType must be an integer type larger than char}} - std::binomial_distribution okdist; - (void)baddist; - (void)okdist; - } - { - std::discrete_distribution baddist; //expected-error@*:* {{IntType must be an integer type larger than char}} - std::discrete_distribution okdist; - (void)baddist; - (void)okdist; - } - { - std::geometric_distribution baddist; //expected-error@*:* {{IntType must be an integer type larger than char}} - std::geometric_distribution okdist; - (void)baddist; - (void)okdist; - } - { - std::negative_binomial_distribution baddist; //expected-error@*:* {{IntType must be an integer type larger than char}} - std::negative_binomial_distribution okdist; - (void)baddist; - (void)okdist; - } - { - std::poisson_distribution baddist; //expected-error@*:* {{IntType must be an integer type larger than char}} - std::poisson_distribution okdist; - (void)baddist; - (void)okdist; - } - { - std::uniform_int_distribution baddist; //expected-error@*:* {{IntType must be an integer type larger than char}} - std::uniform_int_distribution okdist; - (void)baddist; - (void)okdist; - } -}