Do not warn with -Wuninitialized when the member is used in a sizeof or address-of...
[clang.git] / test / Parser / objc-try-catch-1.m
blob719369124e5cf4d380a40f3c3d40c63e53c1f954
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -x objective-c++ %s
3 void * proc();
5 @interface NSConstantString
6 @end
8 @interface Frob
9 @end
11 @interface Frob1
12 @end
14 void * foo()
16   @try {
17     return proc();
18   }
19   @catch (Frob* ex) {
20     @throw;
21   }
22   @catch (Frob1* ex) {
23     @throw proc();
24   }
25   @finally {
26     @try {
27       return proc();
28     }
29     @catch (Frob* ex) {
30       @throw 1,2; // expected-error {{@throw requires an Objective-C object type ('int' invalid)}} \
31                                   // expected-warning {{expression result unused}}
32     }
33     @catch (float x) {  // expected-error {{@catch parameter is not a pointer to an interface type}}
34       
35     }
36     @catch(...) {
37       @throw (4,3,proc()); // expected-warning {{expression result unused}} \
38                                                    // expected-warning {{expression result unused}}
39     }
40   }
42   @try {  // expected-error {{@try statement without a @catch and @finally clause}}
43     return proc();
44   }
48 void bar()
50   @try {}// expected-error {{@try statement without a @catch and @finally clause}}
51   @"s"; //  expected-warning {{result unused}}
54 void baz()
56   @try {}// expected-error {{@try statement without a @catch and @finally clause}}
57   @try {}
58   @finally {}
61 void noTwoTokenLookAheadRequiresABitOfFancyFootworkInTheParser() {
62     @try {
63         // Do something
64     } @catch (...) {}
65     @try {
66         // Do something
67     } @catch (...) {}
68     return;