https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85466
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #5)
> I see sth like
>
> template<typename _RealType, size_t __bits,
> typename _UniformRandomNumberGenerator>
> _RealType
> generate_canonical(_UniformRandomNumberGenerator& __urng)
> {
> ...
> __ret = std::nextafter(_RealType(1), _RealType(0));
>
> instantiated as
>
> _RealType std::generate_canonical(_UniformRandomNumberGenerator&) [with
> _RealType = double; long unsigned int __bits = 53;
> _UniformRandomNumberGenerator = std::mersenne_twister_engine<long unsigned
> int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15,
> 4022730752, 18, 1812433253>] (struct mersenne_twister_engine & __urng)
> {
> ...
> const long double __r;
> ^^^
> (but that's unused it seems)
It's used to calculate __log2r which is the maximum range of the random bit
generator __urng.
> ...
> __ret = nextafter (1.0e+0, 0.0);
>
> and cmath containing
>
> constexpr float
> nextafter(float __x, float __y)
> { return __builtin_nextafterf(__x, __y); }
>
> constexpr long double
> nextafter(long double __x, long double __y)
> { return __builtin_nextafterl(__x, __y); }
>
>
>
> template<typename _Tp, typename _Up>
> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
> nextafter(_Tp __x, _Up __y)
> {
> typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
> return nextafter(__type(__x), __type(__y));
> }
And also:
using ::nextafter;
> which means std::nextafter will use the long double variant?
No, in the instantiation of generate_canonical<double, ...> it uses the
nextafter(double, double) from libc that's added to namespace std by "using
::nextafter".