Home | History | Annotate | Download | only in except.spec
      1 // RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
      2 
      3 // Deallocation functions are implicitly noexcept.
      4 // Thus, explicit specs aren't allowed to conflict.
      5 
      6 void f() {
      7   // Force implicit declaration of delete.
      8   delete new int;
      9   delete[] new int[1];
     10 }
     11 
     12 void operator delete(void*);
     13 void operator delete[](void*);
     14 
     15 static_assert(noexcept(operator delete(0)), "");
     16 static_assert(noexcept(operator delete[](0)), "");
     17 
     18 // Same goes for explicit declarations.
     19 void operator delete(void*, float);
     20 void operator delete[](void*, float);
     21 
     22 static_assert(noexcept(operator delete(0, 0.f)), "");
     23 static_assert(noexcept(operator delete[](0, 0.f)), "");
     24 
     25 // But explicit specs stay.
     26 void operator delete(void*, double) throw(int); // expected-note {{previous}}
     27 static_assert(!noexcept(operator delete(0, 0.)), "");
     28 void operator delete(void*, double) noexcept; // expected-error {{does not match}}
     29