| Issue |
107715
|
| Summary |
[clang] `_Pragma("clang diagnostic ignored \"-Wconstant-evaluated\"")` with push+pop sometimes doesn't work when there are macros involved
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
MitalAshok
|
Minimised to <https://godbolt.org/z/96d8bnsKa>:
```c++
#define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
#define A \
(_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wconstant-evaluated\"") \
__builtin_is_constant_evaluated() \
_LIBCPP_DIAGNOSTIC_POP)
#define echo(...) __VA_ARGS__
static_assert(echo(A), "");
```
```
<source>:11:20: warning: '__builtin_is_constant_evaluated' will always evaluate to 'true' in a manifestly constant-evaluated _expression_ [-Wconstant-evaluated]
11 | static_assert(echo(A), "");
| ^
<source>:6:4: note: expanded from macro 'A'
6 | __builtin_is_constant_evaluated() \
| ^
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs