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: unassignedclangb...@nondot.org
          Reporter: johel...@gmail.com
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    johel...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to