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

            Bug ID: 123909
           Summary: Requires-clause after function is incorrectly parsed
                    as part of the declarator
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luigighiron at gmail dot com
  Target Milestone: ---

The following code is incorrectly rejected by GCC:

template<typename>void(*f())()requires true;
int main(){}

Moreover, the following is incorrectly accepted by GCC:

template<typename>void(*g()requires true)();
int main(){}

This also extends to member functions. Clang, MSVC, and EDG get this correct,
accepting f and rejecting g. The grammar specifications for init-declarator,
function-definition, and member-declarator put the requires-clause immediately
after the declarator instead of being part of the parameters-and-qualifiers in
the declarator.

Reply via email to