1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
2 | |
3 | // Various tests for -fno-exceptions |
4 | |
5 | typedef __SIZE_TYPE__ size_t; |
6 | |
7 | namespace test0 { |
8 | // rdar://problem/7878149 |
9 | class Foo { |
10 | public: |
11 | void* operator new(size_t x); |
12 | private: |
13 | void operator delete(void *x); |
14 | }; |
15 | |
16 | void test() { |
17 | // Under -fexceptions, this does access control for the associated |
18 | // 'operator delete'. |
19 | (void) new Foo(); |
20 | } |
21 | } |
22 | |
23 | namespace test1 { |
24 | void f() { |
25 | throw; // expected-error {{cannot use 'throw' with exceptions disabled}} |
26 | } |
27 | |
28 | void g() { |
29 | try { // expected-error {{cannot use 'try' with exceptions disabled}} |
30 | f(); |
31 | } catch (...) { |
32 | } |
33 | } |
34 | |
35 | } |
36 | |