1 // RUN: %clang_cc1 -fsyntax-only -fexceptions -fcxx-exceptions -verify %s
use_new(int N)2 int *use_new(int N) {
3 if (N == 1)
4 return new int;
5
6 return new int [N];
7 }
8
use_delete(int * ip,int N)9 void use_delete(int* ip, int N) {
10 if (N == 1)
11 delete ip;
12 else
13 delete [] ip;
14 }
15
16 namespace std {
17 class bad_alloc { };
18
19 typedef __SIZE_TYPE__ size_t;
20 }
21
22 void* operator new(std::size_t) throw(std::bad_alloc); // expected-note{{previous declaration}}
23 void* operator new[](std::size_t) throw(std::bad_alloc);
24 void operator delete(void*) throw(); // expected-note{{previous declaration}}
25 void operator delete[](void*) throw();
26
27 void* operator new(std::size_t); // expected-warning{{'operator new' is missing exception specification 'throw(std::bad_alloc)'}}
28 void operator delete(void*); // expected-warning{{'operator delete' is missing exception specification 'throw()'}}
29