blob: 255453135b0169b80acf8b9c10c96c19b3afb496 [file] [log] [blame]
// RUN: clang -fsyntax-only -verify %s &&
// RUN: clang -fsyntax-only -verify -x objective-c++ %s
void * proc();
@interface NSConstantString
@end
@interface Frob
@end
@interface Frob1
@end
void * foo()
{
@try {
return proc();
}
@catch (Frob* ex) {
@throw;
}
@catch (Frob1* ex) {
@throw proc();
}
@finally {
@try {
return proc();
}
@catch (Frob* ex) {
@throw 1,2; // expected-error {{invalid 'int' argument (expected an ObjC object type)}}
}
@catch(...) {
@throw (4,3,proc());
}
}
@try { // expected-error {{@try statement without a @catch and @finally clause}}
return proc();
}
}
void bar()
{
@try {}// expected-error {{@try statement without a @catch and @finally clause}}
@"s"; // expected-warning {{result unused}}
}
void baz()
{
@try {}// expected-error {{@try statement without a @catch and @finally clause}}
@try {}
@finally {}
}
void noTwoTokenLookAheadRequiresABitOfFancyFootworkInTheParser() {
@try {
// Do something
} @catch (...) {}
@try {
// Do something
} @catch (...) {}
return;
}