Issue |
157050
|
Summary |
[clang] Macros in the argument of _Pragma operator are expanded
|
Labels |
clang
|
Assignees |
|
Reporter |
vasama
|
https://godbolt.org/z/zfEP7e4bz
Clang version: 21.1.0
Reproducer:
`clang -E test.cpp`
`test.cpp`:
```CPP
#pragma push_macro("M")
#define M 1
#define N "M"
M
_Pragma("pop_macro(N)")
M
```
Output:
```
1
M
```
Problem:
The `_Pragma` is processed as `#pragma push_macro("M")` with `N` expanded when it shouldn't be.
See the relevant section of the standard: https://eel.is/c++draft/cpp.pragma.op#1
> The resulting sequence of characters is processed through translation phase 3 to produce preprocessing tokens that are executed as if they were the pp-tokens in a pragma directive.
Macro replacement is done as part of phase 4.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs