Issue 154024
Summary [Clang] constant evaluation should reject reinterpret_casting arbitrary addresses
Labels clang
Assignees
Reporter philnik777
    Clang currently accepts
```c++
#define fold(x) (__builtin_constant_p(x) ? (x) : (x))
constexpr int* x = fold((int*)123);
```

It looks like this has been added for GCC compatibility over a decade ago. However, GCC rejects this since version 7: https://godbolt.org/z/qMoK83dfP. I don't see a good reason this should be accepted, especially since GCC has started rejecting it a long time ago by now.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to