aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/cxx1y-sized-deallocation.cpp
blob: 81a8eeb6df93f8d85e29fef3fd0ea534d0f579af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// RUN: %clang_cc1 -std=c++1y -verify %s -fsized-deallocation -fexceptions -fcxx-exceptions

using size_t = decltype(sizeof(0));

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'}}
}