public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "barry.revzin at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101006] New: Request diagnostic for likely concept syntax errors Date: Thu, 10 Jun 2021 01:23:59 +0000 [thread overview] Message-ID: <bug-101006-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101006 Bug ID: 101006 Summary: Request diagnostic for likely concept syntax errors Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider the following: template <typename T> concept Thing = true; template <typename T> concept MemberThing = requires (T t) { t.member() -> Thing; // #1 !requires { t.member(); }; // #2 }; These are likely intended to be (obviously not at the same time, this is just an example): template <typename T> concept MemberThing = requires (T t) { { t.member() } -> Thing; requires !requires { t.member(); }; }; But #1 is very likely to be a bug, and #2 is completely pointless as a requirement since it's tautologically true. It would be nice if gcc could produce warnings in such cases. #2 is a similar case to the P2092 fixup of: template <typename T> concept MemberThing = requires (T t) { requires { t.member(); }; }; which is now ill-formed. However, gcc's diagnostic here could be more helpful too (perhaps including a fixup for an extra requires?) <source>:6:14: error: expected primary-expression before '{' token 6 | requires { t.member(); }; | ^ #1 might be harder to warn about since that could *theoretically* be intended, but if unqualified lookup for Thing actually finds a concept, seems like a good bet for a diagnostic maybe?
next reply other threads:[~2021-06-10 1:24 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-10 1:23 barry.revzin at gmail dot com [this message] 2021-06-10 11:42 ` [Bug c++/101006] " redi at gcc dot gnu.org 2021-06-10 11:50 ` redi 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-101006-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).