xref: /aosp_15_r20/external/clang/test/SemaObjC/undef-superclass-1.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2*67e74705SXin Li
3*67e74705SXin Li@class SUPER, Y; // expected-note 2 {{forward declaration of class here}}
4*67e74705SXin Li
5*67e74705SXin Li@interface INTF :SUPER  // expected-error {{attempting to use the forward class 'SUPER' as superclass of 'INTF'}}
6*67e74705SXin Li@end
7*67e74705SXin Li
8*67e74705SXin Li@interface SUPER @end
9*67e74705SXin Li
10*67e74705SXin Li@interface INTF1 : SUPER  // expected-note {{previous definition is here}}
11*67e74705SXin Li@end
12*67e74705SXin Li
13*67e74705SXin Li@interface INTF2 : INTF1
14*67e74705SXin Li@end
15*67e74705SXin Li
16*67e74705SXin Li@interface INTF3 : Y // expected-error {{attempting to use the forward class 'Y' as superclass of 'INTF3'}} \
17*67e74705SXin Li                     // expected-note{{'INTF3' declared here}}
18*67e74705SXin Li@end
19*67e74705SXin Li
20*67e74705SXin Li@interface INTF1  // expected-error {{duplicate interface definition for class 'INTF1'}}
21*67e74705SXin Li@end
22*67e74705SXin Li
23*67e74705SXin Li@implementation SUPER
24*67e74705SXin Li- (void)dealloc {
25*67e74705SXin Li    [super dealloc]; // expected-error {{'SUPER' cannot use 'super' because it is a root class}}
26*67e74705SXin Li}
27*67e74705SXin Li@end
28*67e74705SXin Li
29*67e74705SXin Li@interface RecursiveClass : RecursiveClass // expected-error {{trying to recursively use 'RecursiveClass' as superclass of 'RecursiveClass'}}
30*67e74705SXin Li@end
31*67e74705SXin Li
32*67e74705SXin Li@implementation RecursiveClass
33*67e74705SXin Li@end
34*67e74705SXin Li
35*67e74705SXin Li@implementation iNTF3 // expected-warning{{cannot find interface declaration for 'iNTF3'; did you mean 'INTF3'?}}
36*67e74705SXin Li@end
37