since it also has an implicit exception specification. Downgrade the error to an extwarn, since at least for operator delete, system headers like to declare it as 'noexcept' whereas the implicit definition does not have an explicit exception specification. Move the exception specification for user-declared 'operator delete' functions from the type-as-written into the type, to reflect reality and to allow us to detect whether there was an implicit exception spec or not. llvm-svn: 166372
29 lines
919 B
C++
29 lines
919 B
C++
// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
|
|
|
|
// Deallocation functions are implicitly noexcept.
|
|
// Thus, explicit specs aren't allowed to conflict.
|
|
|
|
void f() {
|
|
// Force implicit declaration of delete.
|
|
delete new int;
|
|
delete[] new int[1];
|
|
}
|
|
|
|
void operator delete(void*);
|
|
void operator delete[](void*);
|
|
|
|
static_assert(noexcept(operator delete(0)), "");
|
|
static_assert(noexcept(operator delete[](0)), "");
|
|
|
|
// Same goes for explicit declarations.
|
|
void operator delete(void*, float);
|
|
void operator delete[](void*, float);
|
|
|
|
static_assert(noexcept(operator delete(0, 0.f)), "");
|
|
static_assert(noexcept(operator delete[](0, 0.f)), "");
|
|
|
|
// But explicit specs stay.
|
|
void operator delete(void*, double) throw(int); // expected-note {{previous}}
|
|
static_assert(!noexcept(operator delete(0, 0.)), "");
|
|
void operator delete(void*, double) noexcept; // expected-error {{does not match}}
|