public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dimitri.gorokhovik at free dot fr" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98824] New: [C++-20] function template non-type-class-arg deduction fails with a reason that looks bogus Date: Mon, 25 Jan 2021 16:18:10 +0000 [thread overview] Message-ID: <bug-98824-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98824 Bug ID: 98824 Summary: [C++-20] function template non-type-class-arg deduction fails with a reason that looks bogus Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dimitri.gorokhovik at free dot fr Target Milestone: --- The code: template <auto> struct a {}; template <int i, a <i> v> constexpr auto f (a <v>) { return true; }; constexpr a <1> b; auto const p = f (a <b> {}); when compiled with 'g++ -std=c++20 -c bug-14.cpp' (g++ (GCC) 11.0.0 20210123 (experimental)), produces: bug-14.cpp:5:27: error: no matching function for call to ‘f(a<a<1>()>)’ 5 | auto const p = f (a <b> {}); | ^ bug-14.cpp:2:42: note: candidate: ‘template<int i, a<i> v> constexpr auto f(a<((const a<i>)v)>)’ 2 | template <int i, a <i> v> constexpr auto f (a <v>) { return true; }; | ^ bug-14.cpp:2:42: note: template argument deduction/substitution failed: bug-14.cpp:5:27: note: types ‘a<i>’ and ‘const a<1>’ have incompatible cv-qualifiers 5 | auto const p = f (a <b> {}); clang-12 seems to accept it (hits a non-implemented feature in a subsequent pass). The diagnostics looks confusing/misleading: -- compiler is aware of the constness of 'a <i>' -- see the signature of f() in the note for line 2. And then it seemingly removes 'const' from 'const a <i>', maybe expecting a certain strictness level in 'unify()'. However, unify() is called with strict=UNIFY_ALLOW_NONE.
next reply other threads:[~2021-01-25 16:18 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-25 16:18 dimitri.gorokhovik at free dot fr [this message] 2021-01-27 15:33 ` [Bug c++/98824] " dimitri.gorokhovik at free dot fr 2021-08-17 9:24 ` pinskia at gcc dot gnu.org 2022-01-18 5:50 ` bernie at codewiz dot org 2022-01-18 5:51 ` bernie at codewiz dot 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-98824-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).