The r16-6177-g866bc8a9214b1d introduced type-constraint on _Urbg template
parameter in __glibcxx_concepts, which make the mangled inconsistient.
This lead to the missing symbol errors in tests, from
__gnu_cxx::random_condition::throw_conditionally.

libstdc++-v3/ChangeLog:

        * include/bits/random.tcc (generate_canonical)
        [!_GLIBCXX_USE_OLD_GENERATE_CANONICAL]: Use static_assert
        instead of type-constraint on template parameter.
---
I have not yet determined what is causing pre-C++20 version of
__gnu_cxx::random_condition::throw_conditionally to be linked against
post-C++20 version. I am concerned about it, because if we call 
generate_canonical from libstdc++ shared library, then 
_GLIBCXX_USE_OLD_GENERATE_CANONICAL
flag will not properly restore old behavior. Posting anyway to
aknowledge the issue.


 libstdc++-v3/include/bits/random.tcc | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/libstdc++-v3/include/bits/random.tcc 
b/libstdc++-v3/include/bits/random.tcc
index 38e8645c88c..29d50d553e2 100644
--- a/libstdc++-v3/include/bits/random.tcc
+++ b/libstdc++-v3/include/bits/random.tcc
@@ -3619,12 +3619,6 @@ namespace __detail
   template <> const bool __is_rand_dist_float_v<long double> = true;
 #endif
 
-#ifdef __glibcxx_concepts
-# define _Uniform_random_bit_generator uniform_random_bit_generator
-#else
-# define _Uniform_random_bit_generator typename
-#endif
-
   // Note, this works even when (__range + 1) overflows:
   template <typename _Rng>
     constexpr bool __is_power_of_2_less_1(_Rng __range)
@@ -3646,10 +3640,13 @@ namespace __detail
    *  @since C++11
    */
   template<typename _RealT, size_t __digits,
-       _Uniform_random_bit_generator _Urbg>
+          typename _Urbg>
     _RealT
     generate_canonical(_Urbg& __urng)
     {
+#ifdef __glibcxx_concepts
+      static_assert(uniform_random_bit_generator<_Ubrg>);
+#endif      
       static_assert(__is_rand_dist_float_v<_RealT>,
        "template argument must be floating point");
       static_assert(__digits != 0 && _Urbg::max() > _Urbg::min(),
-- 
2.52.0

Reply via email to