public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107649] New: New std::complex specializations are never used Date: Fri, 11 Nov 2022 20:46:22 +0000 [thread overview] Message-ID: <bug-107649-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107649 Bug ID: 107649 Summary: New std::complex specializations are never used Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- In <complex> we have: template<typename _Tp> requires(__complex_type<_Tp>::type) class complex<_Tp> { This partial specialization is never used. The constraint looks for a constant expression with true value, and none of the __complex_type specializations provide that. To test for a type name the constraint must be: template<typename _Tp> requires requires { typename __complex_type<_Tp>::type; } class complex<_Tp> { However if I fix this, so that the partial specialization is used for float64_t etc., then I get a cascade of errors for every overloaded <math.h> function: include/complex: In instantiation of '_Tp std::abs(const complex<_Tp>&) [with _Tp = _Float16]': testsuite/26_numerics/complex/ext_c++23.cc:28: required from 'void test_functions(T*, std::complex<_Tp>*) [with T = _Float16]' testsuite/26_numerics/complex/ext_c++23.cc:56: required from here include/complex:629: error: call of overloaded '__complex_abs(std::complex<_Float16>::_ComplexT)' is ambiguous include/complex:618: note: candidate: 'float std::__complex_abs(__complex__ float)' include/complex:621: note: candidate: 'double std::__complex_abs(__complex__ double)' include/complex:624: note: candidate: 'long double std::__complex_abs(const __complex__ long double&)' include/complex: In instantiation of '_Tp std::arg(const complex<_Tp>&) [with _Tp = _Float16]': testsuite/26_numerics/complex/ext_c++23.cc:29: required from 'void test_functions(T*, std::complex<_Tp>*) [with T = _Float16]' testsuite/26_numerics/complex/ext_c++23.cc:56: required from here include/complex:656: error: call of overloaded '__complex_arg(std::complex<_Float16>::_ComplexT)' is ambiguous include/complex:645: note: candidate: 'float std::__complex_arg(__complex__ float)' include/complex:648: note: candidate: 'double std::__complex_arg(__complex__ double)' include/complex:651: note: candidate: 'long double std::__complex_arg(const __complex__ long double&)' include/complex: In instantiation of 'std::complex<_Tp> std::cos(const complex<_Tp>&) [with _Tp = _Float16]': testsuite/26_numerics/complex/ext_c++23.cc:30: required from 'void test_functions(T*, std::complex<_Tp>*) [with T = _Float16]' testsuite/26_numerics/complex/ext_c++23.cc:56: required from here This is because with the fix to the speclization, __rep() now returns a __complex__ T and so we try to call one of the float/double/longdouble overloads: inline float __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); } inline double __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); } inline long double __complex_abs(const __complex__ long double& __z) { return __builtin_cabsl(__z); } template<typename _Tp> inline _Tp abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
next reply other threads:[~2022-11-11 20:46 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-11 20:46 redi at gcc dot gnu.org [this message] 2022-11-11 20:49 ` [Bug libstdc++/107649] " redi at gcc dot gnu.org 2022-11-11 20:52 ` redi at gcc dot gnu.org 2022-11-12 8:29 ` jakub at gcc dot gnu.org 2022-11-12 12:34 ` redi at gcc dot gnu.org 2022-11-16 13:47 ` cvs-commit at gcc dot gnu.org 2022-11-17 0:36 ` redi at gcc dot gnu.org 2022-11-19 15:08 ` cvs-commit at gcc dot gnu.org 2022-11-28 22:32 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-107649-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).