[llvm-bugs] [Bug 49465] New: Can std::allocator{}.deallocate non allocate()d pointer during constant evaluation
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Mar 6 16:43:00 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49465
Bug ID: 49465
Summary: Can std::allocator{}.deallocate non allocate()d
pointer during constant evaluation
Product: clang
Version: trunk
Hardware: PC
URL: https://godbolt.org/z/KbWKcx
OS: Linux
Status: NEW
Keywords: accepts-invalid
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: johelegp at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
johelegp at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
See https://godbolt.org/z/KbWKcx.
```C++
#include<memory>
struct dyn_array {
int* beg{};
// ...
constexpr void reserve(unsigned) {
// ...
std::allocator<int>{}.deallocate(beg, 0);
}
};
static_assert([] {
dyn_array a;
a.reserve(42);
return a;
}().beg == nullptr);
```
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210307/4138935c/attachment.html>
More information about the llvm-bugs
mailing list