70 lines · plain
1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -fsyntax-only -verify -fobjc-exceptions %s2// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -fsyntax-only -verify -fobjc-exceptions -x objective-c++ %s3void * proc(void);4 5@interface NSConstantString6@end7 8@interface Frob9@end10 11@interface Frob112@end13 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 something63 } @catch (...) {}64 @try {65 // Do something66 } @catch (...) {}67 return;68}69 70