<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/157050>157050</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Macros in the argument of _Pragma operator are expanded
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vasama
</td>
</tr>
</table>
<pre>
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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVMGOpDYQ_RpzKQ0yBkP3gUPPzvStJ61k7ytjV4MTYzu26dndr48MdLKzirQSCJVd9eq9R9kiRj1axJ7wZ8JfCrGkyYX-LqKYRTE49a2fUvKR1CfCzoSdR6cGZ1LpwkjY-Xt-b6_XDpvhO6EnQk-fjLAj3DFE7SypT8Cqsirptvk7-uDUIjFkQHoiLZVr_tMrJIyplN6Tdk8mLf1x7VGwPZ-u1xyy2gcxzgL8Eqcvs5DBEXYgjF0IY4QdtxyFN20RLlB9iN_gkUhPF0JPX64r1gbgnf8X7y0jPfAuP9LYmP62JL-knxgSeqq27f-puAY3GJy3ks8TAmnpo31LQUfwwUmMERWImHd_LbWl8K7TlJPfcoBfvbAKFbxPaEEniJNbjLKEdQkGLDcmfyBCmhACGrwLmyCiTNpZcLd1PSZhlQgq_8qPo4BoSh0JO0vCngl7VkHcUg69LzeqpfOE1bsLpH6Fz2ujuJik7QgR_17QSsyt5CSCkAlD_Cg-TcEt4wQpCBuNWJn5SUSEGpKDfZzAB9xrMnByf6GNkCaRQAQE_IpySZuVepX1Dd4xbMK9f9rztQUBu8lKh-zD_WHTJfsNAb0REme0KdNUzmLG9CKkLGIj1pSF6mt1rI-iwL7qeEfbqm54MfXdgXN2lFwdaCcr1bUNtvxIK9E2su2aptA9o4zTI-X0UPOGl21LZdMxZEeUjIuBNBRnoU1pzH3Op7DQMS7YV7yjnBZGDGjiepoZW49WHg7-UoQ-FzwNyxhJQ42OKf4HkXQy6xWwVfAXWOWujmSLRBiXVbO7wT6l4DwGkVzYDd5GrViC-fnC0GlahlK6mbBz7rh_nnxwf6LMA7MqyIO0i7j37J8AAAD__2nrbds">