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

            Bug ID: 124279
           Summary: Accepts invalid function type with class definition in
                    type-id
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: suyuchang at whu dot edu.cn
  Target Milestone: ---

The code defines a class inside a type-id that forms a function type: using X1
= class X0 { }();. A class definition is not permitted in the result type of a
function. Clang rejects the code, while GCC accepts it.

Code:
using X1 = class X0 { } ( ) ;

Command:
clang++ test.cpp

<source>:1:18: error: 'X0' cannot be defined in the result type of a function
    1 | using X1 = class X0 { } ( )   ; 
      |                  ^
1 error generated.
Compiler returned: 1

See Compiler Explorer:https://godbolt.org/z/Tdh4Yzf8T

The test case was generated by a fuzzer.

Reply via email to