blob: f7395683c3f5d65109348af0323d55f79cef0524 [file] [log] [blame]
John McCall9c82afc2010-04-20 02:18:25 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3// Various tests for -fno-exceptions
4
5typedef __SIZE_TYPE__ size_t;
6
7namespace 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}
Anders Carlsson7f11d9c2011-02-19 19:26:44 +000022
23namespace test1 {
24void f() {
25 throw; // expected-error {{cannot use 'throw' with exceptions disabled}}
26}
27
28void g() {
29 try { // expected-error {{cannot use 'try' with exceptions disabled}}
30 f();
31 } catch (...) {
32 }
33}
34
35}