mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-27 13:05:24 +08:00
9cd4eeefcc
In C++20 <memory> depends on <bits/ranges_unitialized.h> which depends on <bits/random.h> just for a single concept. Including <bits/random.h> also requires including <cmath>, which is huge due to the C++17 special functions. This change moves the concept to the <bits/uniform_int_dist.h> internal header that exists so that <bits/stl_algobase.h> doesn't need to include <bits/random.h>. PR libstdc++/92546 (partial) * include/bits/random.h (uniform_random_bit_generator): Move definition to <bits/uniform_int_dist.h>. * include/bits/ranges_algo.h: Include <bits/uniform_int_dist.h> instead of <bits/random.h>. * include/bits/ranges_algobase.h: Do not include <cmath>. * include/bits/uniform_int_dist.h (uniform_random_bit_generator): Move here. * include/std/ranges: Do not include <limits>. * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lineno.
16 lines
505 B
C++
16 lines
505 B
C++
// { dg-do compile { target c++11 } }
|
|
// { dg-require-cstdint "" }
|
|
|
|
#include <random>
|
|
|
|
std::mt19937 urng;
|
|
|
|
std::__detail::_Adaptor<std::mt19937, unsigned long> aurng(urng);
|
|
|
|
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 *-*-* } 158 }
|
|
|
|
// { dg-error "static assertion failed: template argument must be a floating point type" "" { target *-*-* } 3281 }
|