public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105351] [concepts] Constraint checking does correctly match static member attributes Date: Tue, 03 May 2022 14:24:56 +0000 [thread overview] Message-ID: <bug-105351-4-FZhrTBXXBg@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105351-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105351 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Last reconfirmed| |2022-05-03 Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org --- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> --- Er, the real reason the above works is because the type auto* of dummy's template parameter demands that the argument &T::attr2 is an ordinary pointer, not a pointer to member, which implies that it's a static member. We should also be able to check that attr2 is a static member via template<auto> struct dummy; template<typename T> concept C = requires(T v) { v.attr1; typename dummy<T::attr2>; v.fun1(); T::fun2(); }; which Clang is happy with, but GCC incorrectly emits an error during SFINAE: <source>: In substitution of 'template<class auto:1> requires C<auto:1> auto f(auto:1) [with auto:1 = Z]': <source>:48:5: required from here <source>:9:14: error: invalid use of non-static data member 'Z::attr2' 9 | typename dummy<T::attr2>; | ~~~~~~~~~^~~~~~~~~~~~~~~~ <source>:39:15: note: declared here 39 | const int attr2 = 0; | ^~~~~ This is definitely a bug.
next prev parent reply other threads:[~2022-05-03 14:24 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-22 20:29 [Bug c++/105351] New: " gawain.bolton at free dot fr 2022-04-22 20:44 ` [Bug c++/105351] " pinskia at gcc dot gnu.org 2022-04-23 7:22 ` gawain.bolton at free dot fr 2022-04-23 13:18 ` ensadc at mailnesia dot com 2022-05-01 20:02 ` gawain.bolton at free dot fr 2022-05-03 14:00 ` ppalka at gcc dot gnu.org 2022-05-03 14:24 ` ppalka at gcc dot gnu.org [this message] 2022-05-03 19:21 ` cvs-commit at gcc dot gnu.org 2023-04-18 13:38 ` 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-105351-4-FZhrTBXXBg@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).