xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/cxx1y-sized-deallocation.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++1y -verify %s -fsized-deallocation -fexceptions -fcxx-exceptions
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc using size_t = decltype(sizeof(0));
4*f4a2713aSLionel Sambuc 
f(void * p,void * q)5*f4a2713aSLionel Sambuc void f(void *p, void *q) {
6*f4a2713aSLionel Sambuc   // OK, implicitly declared.
7*f4a2713aSLionel Sambuc   operator delete(p, 8);
8*f4a2713aSLionel Sambuc   operator delete[](q, 12);
9*f4a2713aSLionel Sambuc   static_assert(noexcept(operator delete(p, 8)), "");
10*f4a2713aSLionel Sambuc   static_assert(noexcept(operator delete[](q, 12)), "");
11*f4a2713aSLionel Sambuc }
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc void *operator new(size_t bad, size_t idea);
SS14*f4a2713aSLionel Sambuc struct S { S() { throw 0; } };
g()15*f4a2713aSLionel Sambuc void g() {
16*f4a2713aSLionel Sambuc   new (123) S; // expected-error {{'new' expression with placement arguments refers to non-placement 'operator delete'}}
17*f4a2713aSLionel Sambuc }
18