public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101006] New: Request diagnostic for likely concept syntax errors
@ 2021-06-10  1:23 barry.revzin at gmail dot com
  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
  0 siblings, 2 replies; 3+ messages in thread
From: barry.revzin at gmail dot com @ 2021-06-10  1:23 UTC (permalink / raw)
  To: gcc-bugs

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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/101006] Request diagnostic for likely concept syntax errors
  2021-06-10  1:23 [Bug c++/101006] New: Request diagnostic for likely concept syntax errors barry.revzin at gmail dot com
@ 2021-06-10 11:42 ` redi at gcc dot gnu.org
  2021-06-10 11:50 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-10 11:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101006

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |67491
   Last reconfirmed|                            |2021-06-10
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=92044
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/101006] Request diagnostic for likely concept syntax errors
  2021-06-10  1:23 [Bug c++/101006] New: Request diagnostic for likely concept syntax errors barry.revzin at gmail dot com
  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
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-10 11:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101006

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=98768

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Your #1 is a dup of PR 98768

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-10 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  1:23 [Bug c++/101006] New: Request diagnostic for likely concept syntax errors barry.revzin at gmail dot com
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

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).