libstdc++: Fix up <complex> for extended floating point types [PR107649]
Checks
Commit Message
Hi!
As filed by Jonathan in the PR, I've screwed up the requires syntax
in the extended floating point specialization:
- requires(__complex_type<_Tp>::type)
+ requires requires { typename __complex_type<_Tp>::type; }
and doing this change resulted in lots of errors because __complex_whatever
overfloads from extended floating point types were declared after the
templates which used them.
The following patch fixes that.
Bootstrapped/regtested on x86_64-linux and i686-linux, additionally
I've tested that with _GLIBCXX_HAVE_FLOAT128_MATH not being defined
while __STDCPP_FLOAT128_T__ defined one can still use
std::complex<std::float128_t> for basic arithmetic etc., just one can't
expect std::sin etc. to work in that case (because we don't have any
implementation).
Ok for trunk?
2022-11-14 Jakub Jelinek <jakub@redhat.com>
Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/107649
* include/std/complex (__complex_abs, __complex_arg, __complex_cos,
__complex_cosh, __complex_exp, __complex_log, __complex_sin,
__complex_sinh, __complex_sqrt, __complex_tan, __complex_tanh,
__complex_pow): Move __complex__ _Float{16,32,64,128} and
__complex__ decltype(0.0bf16) overloads earlier in the file.
(complex): Fix up requires on the partial specialization for extended
float types.
(__complex_acos, __complex_asin, __complex_atan, __complex_acosh,
__complex_asinh, __complex_atanh): Move
__complex__ _Float{16,32,64,128} and __complex__ decltype(0.0bf16)
overloads earlier in the file.
Jakub
Comments
On Mon, 14 Nov 2022 at 13:57, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> As filed by Jonathan in the PR, I've screwed up the requires syntax
> in the extended floating point specialization:
> - requires(__complex_type<_Tp>::type)
> + requires requires { typename __complex_type<_Tp>::type; }
> and doing this change resulted in lots of errors because __complex_whatever
> overfloads from extended floating point types were declared after the
> templates which used them.
>
> The following patch fixes that.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, additionally
> I've tested that with _GLIBCXX_HAVE_FLOAT128_MATH not being defined
> while __STDCPP_FLOAT128_T__ defined one can still use
> std::complex<std::float128_t> for basic arithmetic etc., just one can't
> expect std::sin etc. to work in that case (because we don't have any
> implementation).
>
> Ok for trunk?
>
OK, thanks for the quick fix.
>
> 2022-11-14 Jakub Jelinek <jakub@redhat.com>
> Jonathan Wakely <jwakely@redhat.com>
>
> PR libstdc++/107649
> * include/std/complex (__complex_abs, __complex_arg, __complex_cos,
> __complex_cosh, __complex_exp, __complex_log, __complex_sin,
> __complex_sinh, __complex_sqrt, __complex_tan, __complex_tanh,
> __complex_pow): Move __complex__ _Float{16,32,64,128} and
> __complex__ decltype(0.0bf16) overloads earlier in the file.
> (complex): Fix up requires on the partial specialization for
> extended
> float types.
> (__complex_acos, __complex_asin, __complex_atan, __complex_acosh,
> __complex_asinh, __complex_atanh): Move
> __complex__ _Float{16,32,64,128} and __complex__ decltype(0.0bf16)
> overloads earlier in the file.
>
> --- libstdc++-v3/include/std/complex.jj 2022-10-31 20:15:49.756552019 +0100
> +++ libstdc++-v3/include/std/complex 2022-11-12 01:56:42.970560123 +0100
> @@ -598,6 +598,264 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> { return __z.imag(); }
> #endif
>
> +#if _GLIBCXX_USE_C99_COMPLEX
> +#if defined(__STDCPP_FLOAT16_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> + inline _Float16
> + __complex_abs(__complex__ _Float16 __z)
> + { return _Float16(__builtin_cabsf(__z)); }
> +
> + inline _Float16
> + __complex_arg(__complex__ _Float16 __z)
> + { return _Float16(__builtin_cargf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_cos(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_ccosf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_cosh(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_ccoshf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_exp(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_cexpf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_log(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_clogf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_sin(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_csinf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_sinh(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_csinhf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_sqrt(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_csqrtf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_tan(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_ctanf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_tanh(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_ctanhf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_pow(__complex__ _Float16 __x, __complex__ _Float16 __y)
> + { return static_cast<__complex__ _Float16>(__builtin_cpowf(__x, __y)); }
> +#endif
> +
> +#if defined(__STDCPP_FLOAT32_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> + inline _Float32
> + __complex_abs(__complex__ _Float32 __z) { return __builtin_cabsf(__z); }
> +
> + inline _Float32
> + __complex_arg(__complex__ _Float32 __z) { return __builtin_cargf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_cos(__complex__ _Float32 __z) { return __builtin_ccosf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_cosh(__complex__ _Float32 __z) { return
> __builtin_ccoshf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_exp(__complex__ _Float32 __z) { return __builtin_cexpf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_log(__complex__ _Float32 __z) { return __builtin_clogf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_sin(__complex__ _Float32 __z) { return __builtin_csinf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_sinh(__complex__ _Float32 __z) { return
> __builtin_csinhf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_sqrt(__complex__ _Float32 __z) { return
> __builtin_csqrtf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_tan(__complex__ _Float32 __z) { return __builtin_ctanf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_tanh(__complex__ _Float32 __z) { return
> __builtin_ctanhf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_pow(__complex__ _Float32 __x, __complex__ _Float32 __y)
> + { return __builtin_cpowf(__x, __y); }
> +#endif
> +
> +#if defined(__STDCPP_FLOAT64_T__) &&
> defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
> + inline _Float64
> + __complex_abs(__complex__ _Float64 __z) { return __builtin_cabs(__z); }
> +
> + inline _Float64
> + __complex_arg(__complex__ _Float64 __z) { return __builtin_carg(__z); }
> +
> + inline __complex__ _Float64
> + __complex_cos(__complex__ _Float64 __z) { return __builtin_ccos(__z); }
> +
> + inline __complex__ _Float64
> + __complex_cosh(__complex__ _Float64 __z) { return __builtin_ccosh(__z);
> }
> +
> + inline __complex__ _Float64
> + __complex_exp(__complex__ _Float64 __z) { return __builtin_cexp(__z); }
> +
> + inline __complex__ _Float64
> + __complex_log(__complex__ _Float64 __z) { return __builtin_clog(__z); }
> +
> + inline __complex__ _Float64
> + __complex_sin(__complex__ _Float64 __z) { return __builtin_csin(__z); }
> +
> + inline __complex__ _Float64
> + __complex_sinh(__complex__ _Float64 __z) { return __builtin_csinh(__z);
> }
> +
> + inline __complex__ _Float64
> + __complex_sqrt(__complex__ _Float64 __z) { return __builtin_csqrt(__z);
> }
> +
> + inline __complex__ _Float64
> + __complex_tan(__complex__ _Float64 __z) { return __builtin_ctan(__z); }
> +
> + inline __complex__ _Float64
> + __complex_tanh(__complex__ _Float64 __z) { return __builtin_ctanh(__z);
> }
> +
> + inline __complex__ _Float64
> + __complex_pow(__complex__ _Float64 __x, __complex__ _Float64 __y)
> + { return __builtin_cpow(__x, __y); }
> +#endif
> +
> +#if defined(__STDCPP_FLOAT128_T__) &&
> defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
> + inline _Float128
> + __complex_abs(__complex__ _Float128 __z) { return __builtin_cabsl(__z);
> }
> +
> + inline _Float128
> + __complex_arg(__complex__ _Float128 __z) { return __builtin_cargl(__z);
> }
> +
> + inline __complex__ _Float128
> + __complex_cos(__complex__ _Float128 __z) { return __builtin_ccosl(__z);
> }
> +
> + inline __complex__ _Float128
> + __complex_cosh(__complex__ _Float128 __z) { return
> __builtin_ccoshl(__z); }
> +
> + inline __complex__ _Float128
> + __complex_exp(__complex__ _Float128 __z) { return __builtin_cexpl(__z);
> }
> +
> + inline __complex__ _Float128
> + __complex_log(__complex__ _Float128 __z) { return __builtin_clogl(__z);
> }
> +
> + inline __complex__ _Float128
> + __complex_sin(__complex__ _Float128 __z) { return __builtin_csinl(__z);
> }
> +
> + inline __complex__ _Float128
> + __complex_sinh(__complex__ _Float128 __z) { return
> __builtin_csinhl(__z); }
> +
> + inline __complex__ _Float128
> + __complex_sqrt(__complex__ _Float128 __z) { return
> __builtin_csqrtl(__z); }
> +
> + inline __complex__ _Float128
> + __complex_tan(__complex__ _Float128 __z) { return __builtin_ctanl(__z);
> }
> +
> + inline __complex__ _Float128
> + __complex_tanh(__complex__ _Float128 __z) { return
> __builtin_ctanhl(__z); }
> +
> + inline __complex__ _Float128
> + __complex_pow(__complex__ _Float128 __x, __complex__ _Float128 __y)
> + { return __builtin_cpowl(__x, __y); }
> +#elif defined(__STDCPP_FLOAT128_T__) &&
> defined(_GLIBCXX_HAVE_FLOAT128_MATH)
> + inline _Float128
> + __complex_abs(__complex__ _Float128 __z) { return
> __builtin_cabsf128(__z); }
> +
> + inline _Float128
> + __complex_arg(__complex__ _Float128 __z) { return
> __builtin_cargf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_cos(__complex__ _Float128 __z) { return
> __builtin_ccosf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_cosh(__complex__ _Float128 __z) { return
> __builtin_ccoshf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_exp(__complex__ _Float128 __z) { return
> __builtin_cexpf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_log(__complex__ _Float128 __z) { return
> __builtin_clogf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_sin(__complex__ _Float128 __z) { return
> __builtin_csinf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_sinh(__complex__ _Float128 __z) { return
> __builtin_csinhf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_sqrt(__complex__ _Float128 __z) { return
> __builtin_csqrtf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_tan(__complex__ _Float128 __z) { return
> __builtin_ctanf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_tanh(__complex__ _Float128 __z) { return
> __builtin_ctanhf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_pow(__complex__ _Float128 __x, __complex__ _Float128 __y)
> + { return __builtin_cpowf128(__x, __y); }
> +#endif
> +
> +#if defined(__STDCPP_BFLOAT16_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> + inline __gnu_cxx::__bfloat16_t
> + __complex_abs(__complex__ decltype(0.0bf16) __z)
> + { return __gnu_cxx::__bfloat16_t(__builtin_cabsf(__z)); }
> +
> + inline __gnu_cxx::__bfloat16_t
> + __complex_arg(__complex__ decltype(0.0bf16) __z)
> + { return __gnu_cxx::__bfloat16_t(__builtin_cargf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_cos(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_ccosf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_cosh(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_ccoshf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_exp(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_cexpf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_log(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_clogf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_sin(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_csinf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_sinh(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_csinhf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_sqrt(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_csqrtf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_tan(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_ctanf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_tanh(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_ctanhf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_pow(__complex__ decltype(0.0bf16) __x,
> + __complex__ decltype(0.0bf16) __y)
> + { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cpowf(__x,
> +
> __y)); }
> +#endif
> +#endif
> +
> // 26.2.7/3 abs(__z): Returns the magnitude of __z.
> template<typename _Tp>
> inline _Tp
> @@ -1080,264 +1338,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> : std::pow(complex<_Tp>(__x), __y);
> }
>
> -#if _GLIBCXX_USE_C99_COMPLEX
> -#if defined(__STDCPP_FLOAT16_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> - inline _Float16
> - __complex_abs(__complex__ _Float16 __z)
> - { return _Float16(__builtin_cabsf(__z)); }
> -
> - inline _Float16
> - __complex_arg(__complex__ _Float16 __z)
> - { return _Float16(__builtin_cargf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_cos(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_ccosf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_cosh(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_ccoshf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_exp(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_cexpf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_log(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_clogf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_sin(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_csinf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_sinh(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_csinhf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_sqrt(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_csqrtf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_tan(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_ctanf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_tanh(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_ctanhf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_pow(__complex__ _Float16 __x, __complex__ _Float16 __y)
> - { return static_cast<__complex__ _Float16>(__builtin_cpowf(__x, __y)); }
> -#endif
> -
> -#if defined(__STDCPP_FLOAT32_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> - inline _Float32
> - __complex_abs(__complex__ _Float32 __z) { return __builtin_cabsf(__z); }
> -
> - inline _Float32
> - __complex_arg(__complex__ _Float32 __z) { return __builtin_cargf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_cos(__complex__ _Float32 __z) { return __builtin_ccosf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_cosh(__complex__ _Float32 __z) { return
> __builtin_ccoshf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_exp(__complex__ _Float32 __z) { return __builtin_cexpf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_log(__complex__ _Float32 __z) { return __builtin_clogf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_sin(__complex__ _Float32 __z) { return __builtin_csinf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_sinh(__complex__ _Float32 __z) { return
> __builtin_csinhf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_sqrt(__complex__ _Float32 __z) { return
> __builtin_csqrtf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_tan(__complex__ _Float32 __z) { return __builtin_ctanf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_tanh(__complex__ _Float32 __z) { return
> __builtin_ctanhf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_pow(__complex__ _Float32 __x, __complex__ _Float32 __y)
> - { return __builtin_cpowf(__x, __y); }
> -#endif
> -
> -#if defined(__STDCPP_FLOAT64_T__) &&
> defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
> - inline _Float64
> - __complex_abs(__complex__ _Float64 __z) { return __builtin_cabs(__z); }
> -
> - inline _Float64
> - __complex_arg(__complex__ _Float64 __z) { return __builtin_carg(__z); }
> -
> - inline __complex__ _Float64
> - __complex_cos(__complex__ _Float64 __z) { return __builtin_ccos(__z); }
> -
> - inline __complex__ _Float64
> - __complex_cosh(__complex__ _Float64 __z) { return __builtin_ccosh(__z);
> }
> -
> - inline __complex__ _Float64
> - __complex_exp(__complex__ _Float64 __z) { return __builtin_cexp(__z); }
> -
> - inline __complex__ _Float64
> - __complex_log(__complex__ _Float64 __z) { return __builtin_clog(__z); }
> -
> - inline __complex__ _Float64
> - __complex_sin(__complex__ _Float64 __z) { return __builtin_csin(__z); }
> -
> - inline __complex__ _Float64
> - __complex_sinh(__complex__ _Float64 __z) { return __builtin_csinh(__z);
> }
> -
> - inline __complex__ _Float64
> - __complex_sqrt(__complex__ _Float64 __z) { return __builtin_csqrt(__z);
> }
> -
> - inline __complex__ _Float64
> - __complex_tan(__complex__ _Float64 __z) { return __builtin_ctan(__z); }
> -
> - inline __complex__ _Float64
> - __complex_tanh(__complex__ _Float64 __z) { return __builtin_ctanh(__z);
> }
> -
> - inline __complex__ _Float64
> - __complex_pow(__complex__ _Float64 __x, __complex__ _Float64 __y)
> - { return __builtin_cpow(__x, __y); }
> -#endif
> -
> -#if defined(__STDCPP_FLOAT128_T__) &&
> defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
> - inline _Float128
> - __complex_abs(__complex__ _Float128 __z) { return __builtin_cabsl(__z);
> }
> -
> - inline _Float128
> - __complex_arg(__complex__ _Float128 __z) { return __builtin_cargl(__z);
> }
> -
> - inline __complex__ _Float128
> - __complex_cos(__complex__ _Float128 __z) { return __builtin_ccosl(__z);
> }
> -
> - inline __complex__ _Float128
> - __complex_cosh(__complex__ _Float128 __z) { return
> __builtin_ccoshl(__z); }
> -
> - inline __complex__ _Float128
> - __complex_exp(__complex__ _Float128 __z) { return __builtin_cexpl(__z);
> }
> -
> - inline __complex__ _Float128
> - __complex_log(__complex__ _Float128 __z) { return __builtin_clogl(__z);
> }
> -
> - inline __complex__ _Float128
> - __complex_sin(__complex__ _Float128 __z) { return __builtin_csinl(__z);
> }
> -
> - inline __complex__ _Float128
> - __complex_sinh(__complex__ _Float128 __z) { return
> __builtin_csinhl(__z); }
> -
> - inline __complex__ _Float128
> - __complex_sqrt(__complex__ _Float128 __z) { return
> __builtin_csqrtl(__z); }
> -
> - inline __complex__ _Float128
> - __complex_tan(__complex__ _Float128 __z) { return __builtin_ctanl(__z);
> }
> -
> - inline __complex__ _Float128
> - __complex_tanh(__complex__ _Float128 __z) { return
> __builtin_ctanhl(__z); }
> -
> - inline __complex__ _Float128
> - __complex_pow(__complex__ _Float128 __x, __complex__ _Float128 __y)
> - { return __builtin_cpowl(__x, __y); }
> -#elif defined(__STDCPP_FLOAT128_T__) &&
> defined(_GLIBCXX_HAVE_FLOAT128_MATH)
> - inline _Float128
> - __complex_abs(__complex__ _Float128 __z) { return
> __builtin_cabsf128(__z); }
> -
> - inline _Float128
> - __complex_arg(__complex__ _Float128 __z) { return
> __builtin_cargf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_cos(__complex__ _Float128 __z) { return
> __builtin_ccosf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_cosh(__complex__ _Float128 __z) { return
> __builtin_ccoshf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_exp(__complex__ _Float128 __z) { return
> __builtin_cexpf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_log(__complex__ _Float128 __z) { return
> __builtin_clogf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_sin(__complex__ _Float128 __z) { return
> __builtin_csinf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_sinh(__complex__ _Float128 __z) { return
> __builtin_csinhf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_sqrt(__complex__ _Float128 __z) { return
> __builtin_csqrtf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_tan(__complex__ _Float128 __z) { return
> __builtin_ctanf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_tanh(__complex__ _Float128 __z) { return
> __builtin_ctanhf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_pow(__complex__ _Float128 __x, __complex__ _Float128 __y)
> - { return __builtin_cpowf128(__x, __y); }
> -#endif
> -
> -#if defined(__STDCPP_BFLOAT16_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> - inline __gnu_cxx::__bfloat16_t
> - __complex_abs(__complex__ decltype(0.0bf16) __z)
> - { return __gnu_cxx::__bfloat16_t(__builtin_cabsf(__z)); }
> -
> - inline __gnu_cxx::__bfloat16_t
> - __complex_arg(__complex__ decltype(0.0bf16) __z)
> - { return __gnu_cxx::__bfloat16_t(__builtin_cargf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_cos(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_ccosf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_cosh(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_ccoshf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_exp(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_cexpf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_log(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_clogf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_sin(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_csinf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_sinh(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_csinhf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_sqrt(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_csqrtf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_tan(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_ctanf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_tanh(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_ctanhf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_pow(__complex__ decltype(0.0bf16) __x,
> - __complex__ decltype(0.0bf16) __y)
> - { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cpowf(__x,
> -
> __y)); }
> -#endif
> -#endif
> -
> /// 26.2.3 complex specializations
> /// complex<float> specialization
> template<>
> @@ -1835,7 +1835,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> #endif
>
> template<typename _Tp>
> - requires(__complex_type<_Tp>::type)
> + requires requires { typename __complex_type<_Tp>::type; }
> class complex<_Tp>
> {
> public:
> @@ -2022,6 +2022,162 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> }
>
> #if _GLIBCXX_USE_C99_COMPLEX_TR1
> +#if defined(__STDCPP_FLOAT16_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> + inline __complex__ _Float16
> + __complex_acos(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_cacosf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_asin(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_casinf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_atan(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_catanf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_acosh(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_cacoshf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_asinh(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_casinhf(__z)); }
> +
> + inline __complex__ _Float16
> + __complex_atanh(__complex__ _Float16 __z)
> + { return static_cast<__complex__ _Float16>(__builtin_catanhf(__z)); }
> +#endif
> +
> +#if defined(__STDCPP_FLOAT32_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> + inline __complex__ _Float32
> + __complex_acos(__complex__ _Float32 __z)
> + { return __builtin_cacosf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_asin(__complex__ _Float32 __z)
> + { return __builtin_casinf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_atan(__complex__ _Float32 __z)
> + { return __builtin_catanf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_acosh(__complex__ _Float32 __z)
> + { return __builtin_cacoshf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_asinh(__complex__ _Float32 __z)
> + { return __builtin_casinhf(__z); }
> +
> + inline __complex__ _Float32
> + __complex_atanh(__complex__ _Float32 __z)
> + { return __builtin_catanhf(__z); }
> +#endif
> +
> +#if defined(__STDCPP_FLOAT64_T__) &&
> defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
> + inline __complex__ _Float64
> + __complex_acos(__complex__ _Float64 __z)
> + { return __builtin_cacos(__z); }
> +
> + inline __complex__ _Float64
> + __complex_asin(__complex__ _Float64 __z)
> + { return __builtin_casin(__z); }
> +
> + inline __complex__ _Float64
> + __complex_atan(__complex__ _Float64 __z)
> + { return __builtin_catan(__z); }
> +
> + inline __complex__ _Float64
> + __complex_acosh(__complex__ _Float64 __z)
> + { return __builtin_cacosh(__z); }
> +
> + inline __complex__ _Float64
> + __complex_asinh(__complex__ _Float64 __z)
> + { return __builtin_casinh(__z); }
> +
> + inline __complex__ _Float64
> + __complex_atanh(__complex__ _Float64 __z)
> + { return __builtin_catanh(__z); }
> +#endif
> +
> +#if defined(__STDCPP_FLOAT128_T__) &&
> defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
> + inline __complex__ _Float128
> + __complex_acos(__complex__ _Float128 __z)
> + { return __builtin_cacosl(__z); }
> +
> + inline __complex__ _Float128
> + __complex_asin(__complex__ _Float128 __z)
> + { return __builtin_casinl(__z); }
> +
> + inline __complex__ _Float128
> + __complex_atan(__complex__ _Float128 __z)
> + { return __builtin_catanl(__z); }
> +
> + inline __complex__ _Float128
> + __complex_acosh(__complex__ _Float128 __z)
> + { return __builtin_cacoshl(__z); }
> +
> + inline __complex__ _Float128
> + __complex_asinh(__complex__ _Float128 __z)
> + { return __builtin_casinhl(__z); }
> +
> + inline __complex__ _Float128
> + __complex_atanh(__complex__ _Float128 __z)
> + { return __builtin_catanhl(__z); }
> +#elif defined(__STDCPP_FLOAT128_T__) &&
> defined(_GLIBCXX_HAVE_FLOAT128_MATH)
> + inline __complex__ _Float128
> + __complex_acos(__complex__ _Float128 __z)
> + { return __builtin_cacosf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_asin(__complex__ _Float128 __z)
> + { return __builtin_casinf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_atan(__complex__ _Float128 __z)
> + { return __builtin_catanf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_acosh(__complex__ _Float128 __z)
> + { return __builtin_cacoshf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_asinh(__complex__ _Float128 __z)
> + { return __builtin_casinhf128(__z); }
> +
> + inline __complex__ _Float128
> + __complex_atanh(__complex__ _Float128 __z)
> + { return __builtin_catanhf128(__z); }
> +#endif
> +
> +#if defined(__STDCPP_BFLOAT16_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> + inline __complex__ decltype(0.0bf16)
> + __complex_acos(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_cacosf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_asin(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_casinf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_atan(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_catanf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_acosh(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_cacoshf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_asinh(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_casinhf(__z)); }
> +
> + inline __complex__ decltype(0.0bf16)
> + __complex_atanh(__complex__ decltype(0.0bf16) __z)
> + { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_catanhf(__z)); }
> +#endif
> +#endif
> +
> +#if _GLIBCXX_USE_C99_COMPLEX_TR1
> inline __complex__ float
> __complex_acos(__complex__ float __z)
> { return __builtin_cacosf(__z); }
> @@ -2247,162 +2403,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> { return __complex_atanh(__z); }
> #endif
>
> -#if _GLIBCXX_USE_C99_COMPLEX_TR1
> -#if defined(__STDCPP_FLOAT16_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> - inline __complex__ _Float16
> - __complex_acos(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_cacosf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_asin(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_casinf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_atan(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_catanf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_acosh(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_cacoshf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_asinh(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_casinhf(__z)); }
> -
> - inline __complex__ _Float16
> - __complex_atanh(__complex__ _Float16 __z)
> - { return static_cast<__complex__ _Float16>(__builtin_catanhf(__z)); }
> -#endif
> -
> -#if defined(__STDCPP_FLOAT32_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> - inline __complex__ _Float32
> - __complex_acos(__complex__ _Float32 __z)
> - { return __builtin_cacosf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_asin(__complex__ _Float32 __z)
> - { return __builtin_casinf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_atan(__complex__ _Float32 __z)
> - { return __builtin_catanf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_acosh(__complex__ _Float32 __z)
> - { return __builtin_cacoshf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_asinh(__complex__ _Float32 __z)
> - { return __builtin_casinhf(__z); }
> -
> - inline __complex__ _Float32
> - __complex_atanh(__complex__ _Float32 __z)
> - { return __builtin_catanhf(__z); }
> -#endif
> -
> -#if defined(__STDCPP_FLOAT64_T__) &&
> defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
> - inline __complex__ _Float64
> - __complex_acos(__complex__ _Float64 __z)
> - { return __builtin_cacos(__z); }
> -
> - inline __complex__ _Float64
> - __complex_asin(__complex__ _Float64 __z)
> - { return __builtin_casin(__z); }
> -
> - inline __complex__ _Float64
> - __complex_atan(__complex__ _Float64 __z)
> - { return __builtin_catan(__z); }
> -
> - inline __complex__ _Float64
> - __complex_acosh(__complex__ _Float64 __z)
> - { return __builtin_cacosh(__z); }
> -
> - inline __complex__ _Float64
> - __complex_asinh(__complex__ _Float64 __z)
> - { return __builtin_casinh(__z); }
> -
> - inline __complex__ _Float64
> - __complex_atanh(__complex__ _Float64 __z)
> - { return __builtin_catanh(__z); }
> -#endif
> -
> -#if defined(__STDCPP_FLOAT128_T__) &&
> defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
> - inline __complex__ _Float128
> - __complex_acos(__complex__ _Float128 __z)
> - { return __builtin_cacosl(__z); }
> -
> - inline __complex__ _Float128
> - __complex_asin(__complex__ _Float128 __z)
> - { return __builtin_casinl(__z); }
> -
> - inline __complex__ _Float128
> - __complex_atan(__complex__ _Float128 __z)
> - { return __builtin_catanl(__z); }
> -
> - inline __complex__ _Float128
> - __complex_acosh(__complex__ _Float128 __z)
> - { return __builtin_cacoshl(__z); }
> -
> - inline __complex__ _Float128
> - __complex_asinh(__complex__ _Float128 __z)
> - { return __builtin_casinhl(__z); }
> -
> - inline __complex__ _Float128
> - __complex_atanh(__complex__ _Float128 __z)
> - { return __builtin_catanhl(__z); }
> -#elif defined(__STDCPP_FLOAT128_T__) &&
> defined(_GLIBCXX_HAVE_FLOAT128_MATH)
> - inline __complex__ _Float128
> - __complex_acos(__complex__ _Float128 __z)
> - { return __builtin_cacosf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_asin(__complex__ _Float128 __z)
> - { return __builtin_casinf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_atan(__complex__ _Float128 __z)
> - { return __builtin_catanf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_acosh(__complex__ _Float128 __z)
> - { return __builtin_cacoshf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_asinh(__complex__ _Float128 __z)
> - { return __builtin_casinhf128(__z); }
> -
> - inline __complex__ _Float128
> - __complex_atanh(__complex__ _Float128 __z)
> - { return __builtin_catanhf128(__z); }
> -#endif
> -
> -#if defined(__STDCPP_BFLOAT16_T__) &&
> defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
> - inline __complex__ decltype(0.0bf16)
> - __complex_acos(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_cacosf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_asin(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_casinf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_atan(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_catanf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_acosh(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_cacoshf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_asinh(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_casinhf(__z)); }
> -
> - inline __complex__ decltype(0.0bf16)
> - __complex_atanh(__complex__ decltype(0.0bf16) __z)
> - { return static_cast<__complex__
> decltype(0.0bf16)>(__builtin_catanhf(__z)); }
> -#endif
> -#endif
> -
> template<typename _Tp>
> inline _Tp
> /// fabs(__z) [8.1.8].
>
> Jakub
>
>
On Wed, 16 Nov 2022 at 13:42, Jonathan Wakely <jwakely@redhat.com> wrote:
>
>
> On Mon, 14 Nov 2022 at 13:57, Jakub Jelinek <jakub@redhat.com> wrote:
>
>> Hi!
>>
>> As filed by Jonathan in the PR, I've screwed up the requires syntax
>> in the extended floating point specialization:
>> - requires(__complex_type<_Tp>::type)
>> + requires requires { typename __complex_type<_Tp>::type; }
>> and doing this change resulted in lots of errors because
>> __complex_whatever
>> overfloads from extended floating point types were declared after the
>> templates which used them.
>>
>> The following patch fixes that.
>>
>> Bootstrapped/regtested on x86_64-linux and i686-linux, additionally
>> I've tested that with _GLIBCXX_HAVE_FLOAT128_MATH not being defined
>> while __STDCPP_FLOAT128_T__ defined one can still use
>> std::complex<std::float128_t> for basic arithmetic etc., just one can't
>> expect std::sin etc. to work in that case (because we don't have any
>> implementation).
>>
>> Ok for trunk?
>>
>
> OK, thanks for the quick fix.
>
Oh, also no released version of Clang can handle the C++20 rules about
'typename' yet, so we get this error:
complex:1843:15: error: no template named 'type' in '__complex_ty
pe<_Tp>'; did you mean 'ctype'?
typedef std::__complex_type<_Tp>::type _ComplexT;
^~~~~~~~~~~~~~~~~~~~~~~~~~
It needs a 'typename' after 'typedef'.
I can add that if you want though.
(It's fixed on Clang trunk, so will be in 16.0.0)
On Wed, Nov 16, 2022 at 01:45:19PM +0000, Jonathan Wakely wrote:
> > On Mon, 14 Nov 2022 at 13:57, Jakub Jelinek <jakub@redhat.com> wrote:
> >
> >> Hi!
> >>
> >> As filed by Jonathan in the PR, I've screwed up the requires syntax
> >> in the extended floating point specialization:
> >> - requires(__complex_type<_Tp>::type)
> >> + requires requires { typename __complex_type<_Tp>::type; }
> >> and doing this change resulted in lots of errors because
> >> __complex_whatever
> >> overfloads from extended floating point types were declared after the
> >> templates which used them.
> >>
> >> The following patch fixes that.
> >>
> >> Bootstrapped/regtested on x86_64-linux and i686-linux, additionally
> >> I've tested that with _GLIBCXX_HAVE_FLOAT128_MATH not being defined
> >> while __STDCPP_FLOAT128_T__ defined one can still use
> >> std::complex<std::float128_t> for basic arithmetic etc., just one can't
> >> expect std::sin etc. to work in that case (because we don't have any
> >> implementation).
> >>
> >> Ok for trunk?
> >>
> >
> > OK, thanks for the quick fix.
> >
>
> Oh, also no released version of Clang can handle the C++20 rules about
> 'typename' yet, so we get this error:
>
> complex:1843:15: error: no template named 'type' in '__complex_ty
> pe<_Tp>'; did you mean 'ctype'?
> typedef std::__complex_type<_Tp>::type _ComplexT;
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
> It needs a 'typename' after 'typedef'.
>
> I can add that if you want though.
Can you? Sorry, I have already committed the patch before noticing your
mail.
Jakub
On Wed, 16 Nov 2022 at 13:47, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, Nov 16, 2022 at 01:45:19PM +0000, Jonathan Wakely wrote:
> > > On Mon, 14 Nov 2022 at 13:57, Jakub Jelinek <jakub@redhat.com> wrote:
> > >
> > >> Hi!
> > >>
> > >> As filed by Jonathan in the PR, I've screwed up the requires syntax
> > >> in the extended floating point specialization:
> > >> - requires(__complex_type<_Tp>::type)
> > >> + requires requires { typename __complex_type<_Tp>::type; }
> > >> and doing this change resulted in lots of errors because
> > >> __complex_whatever
> > >> overfloads from extended floating point types were declared after the
> > >> templates which used them.
> > >>
> > >> The following patch fixes that.
> > >>
> > >> Bootstrapped/regtested on x86_64-linux and i686-linux, additionally
> > >> I've tested that with _GLIBCXX_HAVE_FLOAT128_MATH not being defined
> > >> while __STDCPP_FLOAT128_T__ defined one can still use
> > >> std::complex<std::float128_t> for basic arithmetic etc., just one
> can't
> > >> expect std::sin etc. to work in that case (because we don't have any
> > >> implementation).
> > >>
> > >> Ok for trunk?
> > >>
> > >
> > > OK, thanks for the quick fix.
> > >
> >
> > Oh, also no released version of Clang can handle the C++20 rules about
> > 'typename' yet, so we get this error:
> >
> > complex:1843:15: error: no template named 'type' in '__complex_ty
> > pe<_Tp>'; did you mean 'ctype'?
> > typedef std::__complex_type<_Tp>::type _ComplexT;
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~
> > It needs a 'typename' after 'typedef'.
> >
> > I can add that if you want though.
>
> Can you? Sorry, I have already committed the patch before noticing your
> mail.
>
Yes, no problem, I'll do it.
@@ -598,6 +598,264 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return __z.imag(); }
#endif
+#if _GLIBCXX_USE_C99_COMPLEX
+#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline _Float16
+ __complex_abs(__complex__ _Float16 __z)
+ { return _Float16(__builtin_cabsf(__z)); }
+
+ inline _Float16
+ __complex_arg(__complex__ _Float16 __z)
+ { return _Float16(__builtin_cargf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_cos(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_ccosf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_cosh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_ccoshf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_exp(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_cexpf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_log(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_clogf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_sin(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_csinf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_sinh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_csinhf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_sqrt(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_csqrtf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_tan(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_ctanf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_tanh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_ctanhf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_pow(__complex__ _Float16 __x, __complex__ _Float16 __y)
+ { return static_cast<__complex__ _Float16>(__builtin_cpowf(__x, __y)); }
+#endif
+
+#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline _Float32
+ __complex_abs(__complex__ _Float32 __z) { return __builtin_cabsf(__z); }
+
+ inline _Float32
+ __complex_arg(__complex__ _Float32 __z) { return __builtin_cargf(__z); }
+
+ inline __complex__ _Float32
+ __complex_cos(__complex__ _Float32 __z) { return __builtin_ccosf(__z); }
+
+ inline __complex__ _Float32
+ __complex_cosh(__complex__ _Float32 __z) { return __builtin_ccoshf(__z); }
+
+ inline __complex__ _Float32
+ __complex_exp(__complex__ _Float32 __z) { return __builtin_cexpf(__z); }
+
+ inline __complex__ _Float32
+ __complex_log(__complex__ _Float32 __z) { return __builtin_clogf(__z); }
+
+ inline __complex__ _Float32
+ __complex_sin(__complex__ _Float32 __z) { return __builtin_csinf(__z); }
+
+ inline __complex__ _Float32
+ __complex_sinh(__complex__ _Float32 __z) { return __builtin_csinhf(__z); }
+
+ inline __complex__ _Float32
+ __complex_sqrt(__complex__ _Float32 __z) { return __builtin_csqrtf(__z); }
+
+ inline __complex__ _Float32
+ __complex_tan(__complex__ _Float32 __z) { return __builtin_ctanf(__z); }
+
+ inline __complex__ _Float32
+ __complex_tanh(__complex__ _Float32 __z) { return __builtin_ctanhf(__z); }
+
+ inline __complex__ _Float32
+ __complex_pow(__complex__ _Float32 __x, __complex__ _Float32 __y)
+ { return __builtin_cpowf(__x, __y); }
+#endif
+
+#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
+ inline _Float64
+ __complex_abs(__complex__ _Float64 __z) { return __builtin_cabs(__z); }
+
+ inline _Float64
+ __complex_arg(__complex__ _Float64 __z) { return __builtin_carg(__z); }
+
+ inline __complex__ _Float64
+ __complex_cos(__complex__ _Float64 __z) { return __builtin_ccos(__z); }
+
+ inline __complex__ _Float64
+ __complex_cosh(__complex__ _Float64 __z) { return __builtin_ccosh(__z); }
+
+ inline __complex__ _Float64
+ __complex_exp(__complex__ _Float64 __z) { return __builtin_cexp(__z); }
+
+ inline __complex__ _Float64
+ __complex_log(__complex__ _Float64 __z) { return __builtin_clog(__z); }
+
+ inline __complex__ _Float64
+ __complex_sin(__complex__ _Float64 __z) { return __builtin_csin(__z); }
+
+ inline __complex__ _Float64
+ __complex_sinh(__complex__ _Float64 __z) { return __builtin_csinh(__z); }
+
+ inline __complex__ _Float64
+ __complex_sqrt(__complex__ _Float64 __z) { return __builtin_csqrt(__z); }
+
+ inline __complex__ _Float64
+ __complex_tan(__complex__ _Float64 __z) { return __builtin_ctan(__z); }
+
+ inline __complex__ _Float64
+ __complex_tanh(__complex__ _Float64 __z) { return __builtin_ctanh(__z); }
+
+ inline __complex__ _Float64
+ __complex_pow(__complex__ _Float64 __x, __complex__ _Float64 __y)
+ { return __builtin_cpow(__x, __y); }
+#endif
+
+#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
+ inline _Float128
+ __complex_abs(__complex__ _Float128 __z) { return __builtin_cabsl(__z); }
+
+ inline _Float128
+ __complex_arg(__complex__ _Float128 __z) { return __builtin_cargl(__z); }
+
+ inline __complex__ _Float128
+ __complex_cos(__complex__ _Float128 __z) { return __builtin_ccosl(__z); }
+
+ inline __complex__ _Float128
+ __complex_cosh(__complex__ _Float128 __z) { return __builtin_ccoshl(__z); }
+
+ inline __complex__ _Float128
+ __complex_exp(__complex__ _Float128 __z) { return __builtin_cexpl(__z); }
+
+ inline __complex__ _Float128
+ __complex_log(__complex__ _Float128 __z) { return __builtin_clogl(__z); }
+
+ inline __complex__ _Float128
+ __complex_sin(__complex__ _Float128 __z) { return __builtin_csinl(__z); }
+
+ inline __complex__ _Float128
+ __complex_sinh(__complex__ _Float128 __z) { return __builtin_csinhl(__z); }
+
+ inline __complex__ _Float128
+ __complex_sqrt(__complex__ _Float128 __z) { return __builtin_csqrtl(__z); }
+
+ inline __complex__ _Float128
+ __complex_tan(__complex__ _Float128 __z) { return __builtin_ctanl(__z); }
+
+ inline __complex__ _Float128
+ __complex_tanh(__complex__ _Float128 __z) { return __builtin_ctanhl(__z); }
+
+ inline __complex__ _Float128
+ __complex_pow(__complex__ _Float128 __x, __complex__ _Float128 __y)
+ { return __builtin_cpowl(__x, __y); }
+#elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
+ inline _Float128
+ __complex_abs(__complex__ _Float128 __z) { return __builtin_cabsf128(__z); }
+
+ inline _Float128
+ __complex_arg(__complex__ _Float128 __z) { return __builtin_cargf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_cos(__complex__ _Float128 __z) { return __builtin_ccosf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_cosh(__complex__ _Float128 __z) { return __builtin_ccoshf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_exp(__complex__ _Float128 __z) { return __builtin_cexpf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_log(__complex__ _Float128 __z) { return __builtin_clogf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_sin(__complex__ _Float128 __z) { return __builtin_csinf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_sinh(__complex__ _Float128 __z) { return __builtin_csinhf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_sqrt(__complex__ _Float128 __z) { return __builtin_csqrtf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_tan(__complex__ _Float128 __z) { return __builtin_ctanf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_tanh(__complex__ _Float128 __z) { return __builtin_ctanhf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_pow(__complex__ _Float128 __x, __complex__ _Float128 __y)
+ { return __builtin_cpowf128(__x, __y); }
+#endif
+
+#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __gnu_cxx::__bfloat16_t
+ __complex_abs(__complex__ decltype(0.0bf16) __z)
+ { return __gnu_cxx::__bfloat16_t(__builtin_cabsf(__z)); }
+
+ inline __gnu_cxx::__bfloat16_t
+ __complex_arg(__complex__ decltype(0.0bf16) __z)
+ { return __gnu_cxx::__bfloat16_t(__builtin_cargf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_cos(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ccosf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_cosh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ccoshf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_exp(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cexpf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_log(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_clogf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_sin(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_csinf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_sinh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_csinhf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_sqrt(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_csqrtf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_tan(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ctanf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_tanh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ctanhf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_pow(__complex__ decltype(0.0bf16) __x,
+ __complex__ decltype(0.0bf16) __y)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cpowf(__x,
+ __y)); }
+#endif
+#endif
+
// 26.2.7/3 abs(__z): Returns the magnitude of __z.
template<typename _Tp>
inline _Tp
@@ -1080,264 +1338,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: std::pow(complex<_Tp>(__x), __y);
}
-#if _GLIBCXX_USE_C99_COMPLEX
-#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
- inline _Float16
- __complex_abs(__complex__ _Float16 __z)
- { return _Float16(__builtin_cabsf(__z)); }
-
- inline _Float16
- __complex_arg(__complex__ _Float16 __z)
- { return _Float16(__builtin_cargf(__z)); }
-
- inline __complex__ _Float16
- __complex_cos(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_ccosf(__z)); }
-
- inline __complex__ _Float16
- __complex_cosh(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_ccoshf(__z)); }
-
- inline __complex__ _Float16
- __complex_exp(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_cexpf(__z)); }
-
- inline __complex__ _Float16
- __complex_log(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_clogf(__z)); }
-
- inline __complex__ _Float16
- __complex_sin(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_csinf(__z)); }
-
- inline __complex__ _Float16
- __complex_sinh(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_csinhf(__z)); }
-
- inline __complex__ _Float16
- __complex_sqrt(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_csqrtf(__z)); }
-
- inline __complex__ _Float16
- __complex_tan(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_ctanf(__z)); }
-
- inline __complex__ _Float16
- __complex_tanh(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_ctanhf(__z)); }
-
- inline __complex__ _Float16
- __complex_pow(__complex__ _Float16 __x, __complex__ _Float16 __y)
- { return static_cast<__complex__ _Float16>(__builtin_cpowf(__x, __y)); }
-#endif
-
-#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
- inline _Float32
- __complex_abs(__complex__ _Float32 __z) { return __builtin_cabsf(__z); }
-
- inline _Float32
- __complex_arg(__complex__ _Float32 __z) { return __builtin_cargf(__z); }
-
- inline __complex__ _Float32
- __complex_cos(__complex__ _Float32 __z) { return __builtin_ccosf(__z); }
-
- inline __complex__ _Float32
- __complex_cosh(__complex__ _Float32 __z) { return __builtin_ccoshf(__z); }
-
- inline __complex__ _Float32
- __complex_exp(__complex__ _Float32 __z) { return __builtin_cexpf(__z); }
-
- inline __complex__ _Float32
- __complex_log(__complex__ _Float32 __z) { return __builtin_clogf(__z); }
-
- inline __complex__ _Float32
- __complex_sin(__complex__ _Float32 __z) { return __builtin_csinf(__z); }
-
- inline __complex__ _Float32
- __complex_sinh(__complex__ _Float32 __z) { return __builtin_csinhf(__z); }
-
- inline __complex__ _Float32
- __complex_sqrt(__complex__ _Float32 __z) { return __builtin_csqrtf(__z); }
-
- inline __complex__ _Float32
- __complex_tan(__complex__ _Float32 __z) { return __builtin_ctanf(__z); }
-
- inline __complex__ _Float32
- __complex_tanh(__complex__ _Float32 __z) { return __builtin_ctanhf(__z); }
-
- inline __complex__ _Float32
- __complex_pow(__complex__ _Float32 __x, __complex__ _Float32 __y)
- { return __builtin_cpowf(__x, __y); }
-#endif
-
-#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
- inline _Float64
- __complex_abs(__complex__ _Float64 __z) { return __builtin_cabs(__z); }
-
- inline _Float64
- __complex_arg(__complex__ _Float64 __z) { return __builtin_carg(__z); }
-
- inline __complex__ _Float64
- __complex_cos(__complex__ _Float64 __z) { return __builtin_ccos(__z); }
-
- inline __complex__ _Float64
- __complex_cosh(__complex__ _Float64 __z) { return __builtin_ccosh(__z); }
-
- inline __complex__ _Float64
- __complex_exp(__complex__ _Float64 __z) { return __builtin_cexp(__z); }
-
- inline __complex__ _Float64
- __complex_log(__complex__ _Float64 __z) { return __builtin_clog(__z); }
-
- inline __complex__ _Float64
- __complex_sin(__complex__ _Float64 __z) { return __builtin_csin(__z); }
-
- inline __complex__ _Float64
- __complex_sinh(__complex__ _Float64 __z) { return __builtin_csinh(__z); }
-
- inline __complex__ _Float64
- __complex_sqrt(__complex__ _Float64 __z) { return __builtin_csqrt(__z); }
-
- inline __complex__ _Float64
- __complex_tan(__complex__ _Float64 __z) { return __builtin_ctan(__z); }
-
- inline __complex__ _Float64
- __complex_tanh(__complex__ _Float64 __z) { return __builtin_ctanh(__z); }
-
- inline __complex__ _Float64
- __complex_pow(__complex__ _Float64 __x, __complex__ _Float64 __y)
- { return __builtin_cpow(__x, __y); }
-#endif
-
-#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
- inline _Float128
- __complex_abs(__complex__ _Float128 __z) { return __builtin_cabsl(__z); }
-
- inline _Float128
- __complex_arg(__complex__ _Float128 __z) { return __builtin_cargl(__z); }
-
- inline __complex__ _Float128
- __complex_cos(__complex__ _Float128 __z) { return __builtin_ccosl(__z); }
-
- inline __complex__ _Float128
- __complex_cosh(__complex__ _Float128 __z) { return __builtin_ccoshl(__z); }
-
- inline __complex__ _Float128
- __complex_exp(__complex__ _Float128 __z) { return __builtin_cexpl(__z); }
-
- inline __complex__ _Float128
- __complex_log(__complex__ _Float128 __z) { return __builtin_clogl(__z); }
-
- inline __complex__ _Float128
- __complex_sin(__complex__ _Float128 __z) { return __builtin_csinl(__z); }
-
- inline __complex__ _Float128
- __complex_sinh(__complex__ _Float128 __z) { return __builtin_csinhl(__z); }
-
- inline __complex__ _Float128
- __complex_sqrt(__complex__ _Float128 __z) { return __builtin_csqrtl(__z); }
-
- inline __complex__ _Float128
- __complex_tan(__complex__ _Float128 __z) { return __builtin_ctanl(__z); }
-
- inline __complex__ _Float128
- __complex_tanh(__complex__ _Float128 __z) { return __builtin_ctanhl(__z); }
-
- inline __complex__ _Float128
- __complex_pow(__complex__ _Float128 __x, __complex__ _Float128 __y)
- { return __builtin_cpowl(__x, __y); }
-#elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
- inline _Float128
- __complex_abs(__complex__ _Float128 __z) { return __builtin_cabsf128(__z); }
-
- inline _Float128
- __complex_arg(__complex__ _Float128 __z) { return __builtin_cargf128(__z); }
-
- inline __complex__ _Float128
- __complex_cos(__complex__ _Float128 __z) { return __builtin_ccosf128(__z); }
-
- inline __complex__ _Float128
- __complex_cosh(__complex__ _Float128 __z) { return __builtin_ccoshf128(__z); }
-
- inline __complex__ _Float128
- __complex_exp(__complex__ _Float128 __z) { return __builtin_cexpf128(__z); }
-
- inline __complex__ _Float128
- __complex_log(__complex__ _Float128 __z) { return __builtin_clogf128(__z); }
-
- inline __complex__ _Float128
- __complex_sin(__complex__ _Float128 __z) { return __builtin_csinf128(__z); }
-
- inline __complex__ _Float128
- __complex_sinh(__complex__ _Float128 __z) { return __builtin_csinhf128(__z); }
-
- inline __complex__ _Float128
- __complex_sqrt(__complex__ _Float128 __z) { return __builtin_csqrtf128(__z); }
-
- inline __complex__ _Float128
- __complex_tan(__complex__ _Float128 __z) { return __builtin_ctanf128(__z); }
-
- inline __complex__ _Float128
- __complex_tanh(__complex__ _Float128 __z) { return __builtin_ctanhf128(__z); }
-
- inline __complex__ _Float128
- __complex_pow(__complex__ _Float128 __x, __complex__ _Float128 __y)
- { return __builtin_cpowf128(__x, __y); }
-#endif
-
-#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
- inline __gnu_cxx::__bfloat16_t
- __complex_abs(__complex__ decltype(0.0bf16) __z)
- { return __gnu_cxx::__bfloat16_t(__builtin_cabsf(__z)); }
-
- inline __gnu_cxx::__bfloat16_t
- __complex_arg(__complex__ decltype(0.0bf16) __z)
- { return __gnu_cxx::__bfloat16_t(__builtin_cargf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_cos(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ccosf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_cosh(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ccoshf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_exp(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cexpf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_log(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_clogf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_sin(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_csinf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_sinh(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_csinhf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_sqrt(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_csqrtf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_tan(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ctanf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_tanh(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_ctanhf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_pow(__complex__ decltype(0.0bf16) __x,
- __complex__ decltype(0.0bf16) __y)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cpowf(__x,
- __y)); }
-#endif
-#endif
-
/// 26.2.3 complex specializations
/// complex<float> specialization
template<>
@@ -1835,7 +1835,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
template<typename _Tp>
- requires(__complex_type<_Tp>::type)
+ requires requires { typename __complex_type<_Tp>::type; }
class complex<_Tp>
{
public:
@@ -2022,6 +2022,162 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
+#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __complex__ _Float16
+ __complex_acos(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_cacosf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_asin(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_casinf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_atan(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_catanf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_acosh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_cacoshf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_asinh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_casinhf(__z)); }
+
+ inline __complex__ _Float16
+ __complex_atanh(__complex__ _Float16 __z)
+ { return static_cast<__complex__ _Float16>(__builtin_catanhf(__z)); }
+#endif
+
+#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __complex__ _Float32
+ __complex_acos(__complex__ _Float32 __z)
+ { return __builtin_cacosf(__z); }
+
+ inline __complex__ _Float32
+ __complex_asin(__complex__ _Float32 __z)
+ { return __builtin_casinf(__z); }
+
+ inline __complex__ _Float32
+ __complex_atan(__complex__ _Float32 __z)
+ { return __builtin_catanf(__z); }
+
+ inline __complex__ _Float32
+ __complex_acosh(__complex__ _Float32 __z)
+ { return __builtin_cacoshf(__z); }
+
+ inline __complex__ _Float32
+ __complex_asinh(__complex__ _Float32 __z)
+ { return __builtin_casinhf(__z); }
+
+ inline __complex__ _Float32
+ __complex_atanh(__complex__ _Float32 __z)
+ { return __builtin_catanhf(__z); }
+#endif
+
+#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
+ inline __complex__ _Float64
+ __complex_acos(__complex__ _Float64 __z)
+ { return __builtin_cacos(__z); }
+
+ inline __complex__ _Float64
+ __complex_asin(__complex__ _Float64 __z)
+ { return __builtin_casin(__z); }
+
+ inline __complex__ _Float64
+ __complex_atan(__complex__ _Float64 __z)
+ { return __builtin_catan(__z); }
+
+ inline __complex__ _Float64
+ __complex_acosh(__complex__ _Float64 __z)
+ { return __builtin_cacosh(__z); }
+
+ inline __complex__ _Float64
+ __complex_asinh(__complex__ _Float64 __z)
+ { return __builtin_casinh(__z); }
+
+ inline __complex__ _Float64
+ __complex_atanh(__complex__ _Float64 __z)
+ { return __builtin_catanh(__z); }
+#endif
+
+#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
+ inline __complex__ _Float128
+ __complex_acos(__complex__ _Float128 __z)
+ { return __builtin_cacosl(__z); }
+
+ inline __complex__ _Float128
+ __complex_asin(__complex__ _Float128 __z)
+ { return __builtin_casinl(__z); }
+
+ inline __complex__ _Float128
+ __complex_atan(__complex__ _Float128 __z)
+ { return __builtin_catanl(__z); }
+
+ inline __complex__ _Float128
+ __complex_acosh(__complex__ _Float128 __z)
+ { return __builtin_cacoshl(__z); }
+
+ inline __complex__ _Float128
+ __complex_asinh(__complex__ _Float128 __z)
+ { return __builtin_casinhl(__z); }
+
+ inline __complex__ _Float128
+ __complex_atanh(__complex__ _Float128 __z)
+ { return __builtin_catanhl(__z); }
+#elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
+ inline __complex__ _Float128
+ __complex_acos(__complex__ _Float128 __z)
+ { return __builtin_cacosf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_asin(__complex__ _Float128 __z)
+ { return __builtin_casinf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_atan(__complex__ _Float128 __z)
+ { return __builtin_catanf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_acosh(__complex__ _Float128 __z)
+ { return __builtin_cacoshf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_asinh(__complex__ _Float128 __z)
+ { return __builtin_casinhf128(__z); }
+
+ inline __complex__ _Float128
+ __complex_atanh(__complex__ _Float128 __z)
+ { return __builtin_catanhf128(__z); }
+#endif
+
+#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
+ inline __complex__ decltype(0.0bf16)
+ __complex_acos(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cacosf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_asin(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_casinf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_atan(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_catanf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_acosh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cacoshf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_asinh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_casinhf(__z)); }
+
+ inline __complex__ decltype(0.0bf16)
+ __complex_atanh(__complex__ decltype(0.0bf16) __z)
+ { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_catanhf(__z)); }
+#endif
+#endif
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_acos(__complex__ float __z)
{ return __builtin_cacosf(__z); }
@@ -2247,162 +2403,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return __complex_atanh(__z); }
#endif
-#if _GLIBCXX_USE_C99_COMPLEX_TR1
-#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
- inline __complex__ _Float16
- __complex_acos(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_cacosf(__z)); }
-
- inline __complex__ _Float16
- __complex_asin(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_casinf(__z)); }
-
- inline __complex__ _Float16
- __complex_atan(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_catanf(__z)); }
-
- inline __complex__ _Float16
- __complex_acosh(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_cacoshf(__z)); }
-
- inline __complex__ _Float16
- __complex_asinh(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_casinhf(__z)); }
-
- inline __complex__ _Float16
- __complex_atanh(__complex__ _Float16 __z)
- { return static_cast<__complex__ _Float16>(__builtin_catanhf(__z)); }
-#endif
-
-#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
- inline __complex__ _Float32
- __complex_acos(__complex__ _Float32 __z)
- { return __builtin_cacosf(__z); }
-
- inline __complex__ _Float32
- __complex_asin(__complex__ _Float32 __z)
- { return __builtin_casinf(__z); }
-
- inline __complex__ _Float32
- __complex_atan(__complex__ _Float32 __z)
- { return __builtin_catanf(__z); }
-
- inline __complex__ _Float32
- __complex_acosh(__complex__ _Float32 __z)
- { return __builtin_cacoshf(__z); }
-
- inline __complex__ _Float32
- __complex_asinh(__complex__ _Float32 __z)
- { return __builtin_casinhf(__z); }
-
- inline __complex__ _Float32
- __complex_atanh(__complex__ _Float32 __z)
- { return __builtin_catanhf(__z); }
-#endif
-
-#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
- inline __complex__ _Float64
- __complex_acos(__complex__ _Float64 __z)
- { return __builtin_cacos(__z); }
-
- inline __complex__ _Float64
- __complex_asin(__complex__ _Float64 __z)
- { return __builtin_casin(__z); }
-
- inline __complex__ _Float64
- __complex_atan(__complex__ _Float64 __z)
- { return __builtin_catan(__z); }
-
- inline __complex__ _Float64
- __complex_acosh(__complex__ _Float64 __z)
- { return __builtin_cacosh(__z); }
-
- inline __complex__ _Float64
- __complex_asinh(__complex__ _Float64 __z)
- { return __builtin_casinh(__z); }
-
- inline __complex__ _Float64
- __complex_atanh(__complex__ _Float64 __z)
- { return __builtin_catanh(__z); }
-#endif
-
-#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
- inline __complex__ _Float128
- __complex_acos(__complex__ _Float128 __z)
- { return __builtin_cacosl(__z); }
-
- inline __complex__ _Float128
- __complex_asin(__complex__ _Float128 __z)
- { return __builtin_casinl(__z); }
-
- inline __complex__ _Float128
- __complex_atan(__complex__ _Float128 __z)
- { return __builtin_catanl(__z); }
-
- inline __complex__ _Float128
- __complex_acosh(__complex__ _Float128 __z)
- { return __builtin_cacoshl(__z); }
-
- inline __complex__ _Float128
- __complex_asinh(__complex__ _Float128 __z)
- { return __builtin_casinhl(__z); }
-
- inline __complex__ _Float128
- __complex_atanh(__complex__ _Float128 __z)
- { return __builtin_catanhl(__z); }
-#elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
- inline __complex__ _Float128
- __complex_acos(__complex__ _Float128 __z)
- { return __builtin_cacosf128(__z); }
-
- inline __complex__ _Float128
- __complex_asin(__complex__ _Float128 __z)
- { return __builtin_casinf128(__z); }
-
- inline __complex__ _Float128
- __complex_atan(__complex__ _Float128 __z)
- { return __builtin_catanf128(__z); }
-
- inline __complex__ _Float128
- __complex_acosh(__complex__ _Float128 __z)
- { return __builtin_cacoshf128(__z); }
-
- inline __complex__ _Float128
- __complex_asinh(__complex__ _Float128 __z)
- { return __builtin_casinhf128(__z); }
-
- inline __complex__ _Float128
- __complex_atanh(__complex__ _Float128 __z)
- { return __builtin_catanhf128(__z); }
-#endif
-
-#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
- inline __complex__ decltype(0.0bf16)
- __complex_acos(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cacosf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_asin(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_casinf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_atan(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_catanf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_acosh(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_cacoshf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_asinh(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_casinhf(__z)); }
-
- inline __complex__ decltype(0.0bf16)
- __complex_atanh(__complex__ decltype(0.0bf16) __z)
- { return static_cast<__complex__ decltype(0.0bf16)>(__builtin_catanhf(__z)); }
-#endif
-#endif
-
template<typename _Tp>
inline _Tp
/// fabs(__z) [8.1.8].