xref: /aosp_15_r20/external/clang/test/SemaObjC/stmts.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 %s -verify -fsyntax-only -fobjc-exceptions
2*67e74705SXin Li
3*67e74705SXin Listruct some_struct;
4*67e74705SXin Li
5*67e74705SXin Li@interface NSObject
6*67e74705SXin Li@end
7*67e74705SXin Li
8*67e74705SXin Li// Note: NSException is not declared.
9*67e74705SXin Livoid f0(id x) {
10*67e74705SXin Li  @try {
11*67e74705SXin Li  } @catch (NSException *x) { // expected-error {{unknown type name 'NSException'}}
12*67e74705SXin Li  } @catch (struct some_struct x) { // expected-error {{@catch parameter is not a pointer to an interface type}}
13*67e74705SXin Li  } @catch (int x) { // expected-error {{@catch parameter is not a pointer to an interface type}}
14*67e74705SXin Li  } @catch (static NSObject *y) { // expected-error {{@catch parameter cannot have storage specifier 'static'}}
15*67e74705SXin Li  } @catch (...) {
16*67e74705SXin Li  }
17*67e74705SXin Li}
18*67e74705SXin Li
19