public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gnaggnoyil at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108579] New: Requires-expression that checks constructor on non-template constructor of template class got rejected Date: Sat, 28 Jan 2023 07:40:04 +0000 [thread overview] Message-ID: <bug-108579-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108579 Bug ID: 108579 Summary: Requires-expression that checks constructor on non-template constructor of template class got rejected Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gnaggnoyil at gmail dot com Target Milestone: --- template <typename T> class foo{ public: foo(double, char){} foo(int) requires requires { foo(0.0, 'c'); }{} }; int main(){ foo<int> x(3); (void)x; return 0; } The above code fails to compile on latest GCC trunk with `-std=c++20` as of the day of report: test8.cpp: In instantiation of ‘foo<T>::foo(int) requires requires{foo(0.0, 'c');} [with T = int]’: test8.cpp:9:17: required from here test8.cpp:5:5: required by the constraints of ‘template<class T> foo<T>::foo(int) requires requires{foo(0.0, 'c');}’ test8.cpp:5:23: in requirements [with T = int] test8.cpp:5:23: error: satisfaction value of atomic constraint ‘requires{foo(0.0, 'c');} [with T = int]’ changed from ‘false’ to ‘true’ 5 | foo(int) requires requires { foo(0.0, 'c'); }{} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ test8.cpp:2:7: note: satisfaction value first evaluated to ‘false’ from here 2 | class foo{ | ^~~ test8.cpp: In function ‘int main()’: test8.cpp:9:17: error: no matching function for call to ‘foo<int>::foo(int)’ 9 | foo<int> x(3); | ^ test8.cpp:5:5: note: candidate: ‘foo<T>::foo(int) requires requires{foo(0.0, 'c');} [with T = int]’ 5 | foo(int) requires requires { foo(0.0, 'c'); }{} | ^~~ test8.cpp:5:5: note: constraints not satisfied test8.cpp:4:5: note: candidate: ‘foo<T>::foo(double, char) [with T = int]’ 4 | foo(double, char){} | ^~~ test8.cpp:4:5: note: candidate expects 2 arguments, 1 provided test8.cpp:2:7: note: candidate: ‘constexpr foo<int>::foo(const foo<int>&)’ 2 | class foo{ | ^~~ test8.cpp:2:7: note: no known conversion for argument 1 from ‘int’ to ‘const foo<int>&’ test8.cpp:2:7: note: candidate: ‘constexpr foo<int>::foo(foo<int>&&)’ test8.cpp:2:7: note: no known conversion for argument 1 from ‘int’ to ‘foo<int>&&’ Replacing the "requires {}" part with "is_constructible<foo, double, char>" will get rejected too, but with different error messages. Prior releases of GCC like 12.1 or 12.2 can accept both programs without any problem.
next reply other threads:[~2023-01-28 7:40 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-28 7:40 gnaggnoyil at gmail dot com [this message] 2023-01-28 8:00 ` [Bug c++/108579] [13 Regression] " pinskia at gcc dot gnu.org 2023-01-29 10:56 ` redi at gcc dot gnu.org 2023-01-30 18:31 ` ppalka at gcc dot gnu.org 2023-02-03 14:15 ` cvs-commit at gcc dot gnu.org 2023-02-03 14:16 ` ppalka 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-108579-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).