mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 18:46:40 +00:00

Since C++14 has been released for about nine years and most standard libraries have implemented sized deallocation functions, it's time to make this feature default again. This is another try of https://reviews.llvm.org/D112921. The original commit cf5a8b4 was reverted by 2e5035a due to some failures (see #83774). Fixes #60061
20 lines
694 B
C++
20 lines
694 B
C++
// RUN: %clang_cc1 -std=c++1y -verify %s -fexceptions -fcxx-exceptions
|
|
|
|
using size_t = decltype(sizeof(0));
|
|
void operator delete(void *, size_t) noexcept; // expected-note {{'operator delete' declared here}}
|
|
void operator delete[](void *, size_t) noexcept;
|
|
|
|
void f(void *p, void *q) {
|
|
// OK, implicitly declared.
|
|
operator delete(p, 8);
|
|
operator delete[](q, 12);
|
|
static_assert(noexcept(operator delete(p, 8)), "");
|
|
static_assert(noexcept(operator delete[](q, 12)), "");
|
|
}
|
|
|
|
void *operator new(size_t bad, size_t idea);
|
|
struct S { S() { throw 0; } };
|
|
void g() {
|
|
new (123) S; // expected-error {{'new' expression with placement arguments refers to non-placement 'operator delete'}}
|
|
}
|