Issue |
131432
|
Summary |
Placement new can modify const-qualified variables
|
Labels |
clang:frontend,
consteval
|
Assignees |
|
Reporter |
tbaederr
|
Consider:
```c++
namespace std {
using size_t = decltype(sizeof(0));
}
void *operator new(std::size_t, void *p) { return p; }
void* operator new[] (std::size_t, void* p) {return p;}
constexpr int foo() {
const int a = 10;
new ((int*)&a) int(12);
return a;
}
static_assert(foo() == 12);
```
https://godbolt.org/z/7jj8YsE8r
This should not be accepted of course.
This might be a good first issue, I'm not sure. Maybe @cor3ntin can comment on that.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs