Open llvmbot opened 4 years ago
This behavior still happens with post 17 trunk(bfa3bc437809e0496a79a5ff690212e05b053ab3) https://godbolt.org/z/a9cT3vn1q
code
// compile with -std=c++17 -Wc++2a-compat
#define LPAREN (
#define EXPAND(...) __VA_ARGS__
#define EAT(...)
EAT(requires) // OK, no warning.
EXPAND(EAT LPAREN requires)) // Oops, warning.
warning
<source>:6:21: warning: 'requires' is a keyword in C++20 [-Wc++20-compat]
6 | EXPAND(EAT LPAREN requires)) // Oops, warning.
| ^
1 warning generated.
Compiler returned: 0
CC @AaronBallman @cor3ntin
Extended Description
Compile the following with -std=c++17 -Wc++2a-compat -Werror:
define LPAREN (
define EXPAND(...) __VA_ARGS__
define EAT(...)
EAT(requires) // OK, no warning. EXPAND(EAT LPAREN requires)) // Oops, warning.
This file emits no tokens after full preprocessing; however, the compiler still complains about the presence of the
requires
keyword on the last line. Note thatEAT(requires)
compiles without warning, which leads me to believe that the warning is looking for C++20 keywords after each macro expansion instead of after full expansion.