public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rs2740 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100592] New: Bogus "qualifiers cannot be applied" error with reference type produced by dependent alias template Date: Fri, 14 May 2021 00:22:17 +0000 [thread overview] Message-ID: <bug-100592-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100592 Bug ID: 100592 Summary: Bogus "qualifiers cannot be applied" error with reference type produced by dependent alias template Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rs2740 at gmail dot com Target Milestone: --- template<bool> struct meta { template<class T, class U> using if_c = T; }; template<> struct meta<false> { template<class T, class U> using if_c = U; }; template <bool B, class T, class U> using if_c = typename meta<B>::template if_c<T, U>; template<class> inline constexpr bool b = false; template <class T> using foo = if_c<b<T>, int, T>; template<class T> struct type {}; template <typename T> using test = type<foo<T> const&>; template<class T> test<T> f(); void g() { f<int&>(); } GCC rejects: <source>: In function 'void g()': <source>:32:12: error: no matching function for call to 'f<int&>()' 32 | f<int&>(); | ~~~~~~~^~ <source>:29:9: note: candidate: 'template<class T> test<T> f()' 29 | test<T> f(); | ^ <source>:29:9: note: template argument deduction/substitution failed: <source>: In substitution of 'template<class T> using test = type<const typename meta<b<T> >::if_c<int, T>&> [with T = int&]': <source>:29:9: required by substitution of 'template<class T> test<T> f() [with T = int&]' <source>:32:12: required from here <source>:26:7: error: 'const' qualifiers cannot be applied to 'meta<false>::if_c<int, int&>' {aka 'int&'} 26 | using test = type<foo<T> const&>; | ^~~~
next reply other threads:[~2021-05-14 0:22 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-14 0:22 rs2740 at gmail dot com [this message] 2021-05-14 7:19 ` [Bug c++/100592] " marxin at gcc dot gnu.org 2021-06-02 16:16 ` ppalka at gcc dot gnu.org 2021-06-03 13:39 ` cvs-commit at gcc dot gnu.org 2021-11-07 0:27 ` 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-100592-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).