1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -fsyntax-only -verify -fobjc-exceptions %s 2// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -fsyntax-only -verify -fobjc-exceptions -x objective-c++ %s 3void * proc(void); 4 5@interface NSConstantString 6@end 7 8@interface Frob 9@end 10 11@interface Frob1 12@end 13 14void * foo(void) 15{ 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 {{left operand of comma operator has no effect}} 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 2{{left operand of comma operator has no effect}} 38 } 39 } 40 41 @try { // expected-error {{@try statement without a @catch and @finally clause}} 42 return proc(); 43 } 44} 45 46 47void bar(void) 48{ 49 @try {}// expected-error {{@try statement without a @catch and @finally clause}} 50 @"s"; // expected-warning {{result unused}} 51} 52 53void baz(void) 54{ 55 @try {}// expected-error {{@try statement without a @catch and @finally clause}} 56 @try {} 57 @finally {} 58} 59 60void noTwoTokenLookAheadRequiresABitOfFancyFootworkInTheParser(void) { 61 @try { 62 // Do something 63 } @catch (...) {} 64 @try { 65 // Do something 66 } @catch (...) {} 67 return; 68} 69 70