public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103478] Possible regression in constexpr processing Date: Mon, 29 Nov 2021 20:27:50 +0000 [thread overview] Message-ID: <bug-103478-4-ZKpSb7a4CW@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103478-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103478 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- That is: template<class S> constexpr auto test(const S& s) noexcept-> decltype(auto) { return test_helper(s, make_index_sequence<strsize(s)>{}); } Is invalid. Clang rejects it too but with a better diagnostic: <source>:30:46: error: non-type template argument is not a constant expression return test_helper(s, make_index_sequence<strsize(s)>{}); ^~~~~~~~~~ <source>:35:27: note: in instantiation of function template specialization 'test<char[4]>' requested here static_assert(noexcept(test("qwe")) == true, ""); ^ <source>:30:54: note: function parameter 's' with unknown value cannot be used in a constant expression return test_helper(s, make_index_sequence<strsize(s)>{}); ^ <source>:29:30: note: declared here constexpr auto test(const S& s) noexcept-> decltype(auto) { ^ So I will leave it open for a better error message request.
next prev parent reply other threads:[~2021-11-29 20:27 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-29 20:20 [Bug c++/103478] New: " fchelnokov at gmail dot com 2021-11-29 20:25 ` [Bug c++/103478] " pinskia at gcc dot gnu.org 2021-11-29 20:27 ` pinskia at gcc dot gnu.org [this message] 2021-11-30 7:05 ` rguenth at gcc dot gnu.org 2021-11-30 14:23 ` marxin at gcc dot gnu.org 2021-12-01 2:24 ` [Bug c++/103478] More explanation for error on constexpr function parameter used in a constant expression jason 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-103478-4-ZKpSb7a4CW@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).