https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109818
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Janez Zemva from comment #8)
> I took a look and I believe the c_global is already being selected and I
> believe the hack I presented should perhaps be applied to
> libstdc++-v3/include/c_global/cmath
No, absolutely not, std::trunc is already defined in that file, see line 2023:
using ::trunc;
using ::truncf;
using ::truncl;
And then at line 2642:
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
constexpr float
trunc(float __x)
{ return __builtin_truncf(__x); }
constexpr long double
trunc(long double __x)
{ return __builtin_truncl(__x); }
#endif
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
template<typename _Tp>
constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
trunc(_Tp __x)
{ return __builtin_trunc(__x); }
#endif
(In reply to Janez Zemva from comment #9)
> I'd also like to mention, that the hack is already present in the c_global
> cmath file, but is perhaps in a wrong section of the file, i.e. it is in the
> section protected by:
>
> #if defined(__STDCPP_FLOAT64_T__) &&
> defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
>
> while I can see _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 is defined in c++config.h,
> I don't see __STDCPP_FLOAT64_T__ defined anywhere.
No, you're looking at the definition for trunc(_Float64) which is a completely
different overload.