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

            Bug ID: 118586
           Summary: [15 Regression] Parsing error with #embed or long
                    method argument list
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: objc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

@interface Foo
+ (int) bar: (int) firstNumber, int secondNumber, ...;
@end

void
baz (void)
{
  [Foo bar: 1, 2,
#embed __FILE__
       , -1];
}
fails with
embed-1.mm: In function ‘void baz()’:
embed-1.mm:8:4: error: capture of non-variable ‘Foo’
    8 |   [Foo bar: 1, 2,
      |    ^~~
embed-1.mm:1:12: note: ‘struct Foo’ declared here
    1 | @interface Foo
      |            ^~~
embed-1.mm:8:7: error: expected ‘,’ before ‘bar’
    8 |   [Foo bar: 1, 2,
      |       ^~~~
      |       ,
embed-1.mm:8:8: error: ‘bar’ was not declared in this scope; did you mean
‘baz’?
    8 |   [Foo bar: 1, 2,
      |        ^~~
      |        baz
embed-1.mm:8:11: error: expected ‘,’ before ‘:’ token
    8 |   [Foo bar: 1, 2,
      |           ^
      |           ,
embed-1.mm:8:11: error: expected identifier before ‘:’ token
embed-1.mm:8:14: error: expected ‘]’ before ‘,’ token
    8 |   [Foo bar: 1, 2,
      |              ^
      |              ]
embed-1.mm: In lambda function:
embed-1.mm:8:14: error: expected ‘{’ before ‘,’ token
embed-1.mm: In function ‘void baz()’:
embed-1.mm:10:12: error: expected ‘;’ before ‘]’ token
   10 |        , -1];
      |            ^
      |            ;

Similarly if #embed __FILE__ is replaced by comma separated list of 128+ 0-255
numbers.  The latter is a regression from 14.2.1.

Reply via email to