[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / no-exceptions.cpp
blobf7395683c3f5d65109348af0323d55f79cef0524
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // Various tests for -fno-exceptions
5 typedef __SIZE_TYPE__ size_t;
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);
16 void test() {
17 // Under -fexceptions, this does access control for the associated
18 // 'operator delete'.
19 (void) new Foo();
23 namespace test1 {
24 void f() {
25 throw; // expected-error {{cannot use 'throw' with exceptions disabled}}
28 void g() {
29 try { // expected-error {{cannot use 'try' with exceptions disabled}}
30 f();
31 } catch (...) {