llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.61k stars 11.82k forks source link

Assertion Error when expanding macro with consecutive ## tokens and empty parameters. #113236

Open mrolle45 opened 2 hours ago

mrolle45 commented 2 hours ago

Assertion failed: (!NonEmptyPasteBefore || PasteBefore || VCtx.isInVAOpt()) && "unexpected ## in ResultToks", file D:\GitHub\Repos\LLVM\llvm-project\clang\lib\Lex\TokenLexer.cpp, line 414

I got this while running clang on this code:

#define FOO(a,b,c) ;b########c,b##########c,a########a,a##########a, (more...)
FOO (,y,z)

I set a breakpoint at this line, condition being I == 22. Tokens[22] is the comma after the fourth a. Thus PasteBefore is false. However, ResultToks ends with ▶ | [15] | comma | clang::Token ▶ | [16] | hashhash | clang::Token ▶ | [17] | hashhash | clang::Token

llvmbot commented 2 hours ago

@llvm/issue-subscribers-clang-frontend

Author: None (mrolle45)

`Assertion failed: (!NonEmptyPasteBefore || PasteBefore || VCtx.isInVAOpt()) && "unexpected ## in ResultToks", file D:\GitHub\Repos\LLVM\llvm-project\clang\lib\Lex\TokenLexer.cpp, line 414` I got this while running clang on this code: ``` c #define FOO(a,b,c) ;b########c,b##########c,a########a,a##########a, (more...) FOO (,y,z) ``` I set a breakpoint at this line, condition being `I == 22`. `Tokens[22]` is the comma after the fourth `a`. Thus `PasteBefore` is false. However, `ResultToks` ends with ▶ | [15] | comma | clang::Token ▶ | [16] | hashhash | clang::Token ▶ | [17] | hashhash | clang::Token ```