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

            Bug ID: 124284
           Summary: Accepts invalid malformed attribute syntax with
                    mismatched brackets
           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 contains malformed C++11 attribute syntax with mismatched brackets and
parentheses. Clang rejects it but GCC accepts it.

Code:
[ [ X0 ( ] [ ) ] ] ;

Command:
clang++ test.cpp

<source>:1:19: error: expected ']'
    1 | [ [ X0 ( ] [ ) ] ] ;
      |                   ^
      |                   ]
<source>:1:21: error: expected external declaration
    1 | [ [ X0 ( ] [ ) ] ] ;
      |                     ^
2 errors generated.

See Compiler Explorer:https://godbolt.org/z/4TrM3hsd1

The test case was generated by a fuzzer.

Reply via email to