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

            Bug ID: 111041
           Summary: Malformed requires syntax should produce better
                    diagnostics
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s_gccbugzilla at nedprod dot com
  Target Milestone: ---

I know this will be a minor enhancement request, however I would like this to
produce more useful diagnostics:

template<class T> concept test1 = requires(T x) { x.foo() -> bool;};

Currently we get "error: expected unqualified-id before 'bool'".

template<class T> concept test1 = requires(T x) { x.foo() ->
std::same_as<bool>;};

Currently we get "error: wrong number of template arguments (1, should be 2)".


I would like something like "error: requires item needs curly brackets if
requiring return type yielded from an expression".

I know this will seem an inconsequential enhancement request, but I lost
several hours of productivity today because I forgot the curly brackets in some
deeply nested requires clauses, and the current GCC diagnostics did not help my
tired old eyes see I had forgotten the curly brackets. I kept staring at it,
couldn't see the issue, and it was curly brackets all along.
  • [Bug c++/111041] New: Malfor... s_gccbugzilla at nedprod dot com via Gcc-bugs

Reply via email to