xref: /llvm-project/clang/test/Lexer/update_consecutive_macro_crash.cpp (revision 341dd6076b123946f79a3148b660d6579f9683a7)
1 // RUN: %clang -cc1 -fsyntax-only -verify %s 2>&1
2 
3 #define X(val2) Y(val2++) // expected-note {{macro 'X' defined here}}
4 #define Y(expression) expression ;
5 
foo()6 void foo() {
7   // https://github.com/llvm/llvm-project/issues/60722:
8   //
9   // - Due to to the error recovery, the lexer inserts a pair of () around the
10   //   macro argument int{,}, so we will see [(, int, {, ,, }, )] tokens.
11   // - however, the size of file id for the macro argument only takes account
12   //   the written tokens  int{,} , and the extra inserted ) token points to the
13   //    Limit source location which triggered an empty Partition violation.
14   X(int{,}); // expected-error {{too many arguments provided to function-like macro invocation}} \
15                  expected-error {{expected expression}} \
16                  expected-note {{parentheses are required around macro argument containing braced initializer list}}
17 }
18