blob: e8e03c5938f2593b3866424508c0f21a71b50296 [file] [log] [blame]
Patrick Beardb2f68202012-04-06 18:12:22 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
Fariborz Jahanian4b6df3f2007-10-04 00:22:33 +00002
Douglas Gregorb3029962011-11-14 22:10:01 +00003@class SUPER, Y; // expected-note 2 {{forward declaration of class here}}
Fariborz Jahanian1d5b0e32007-09-20 17:54:07 +00004
Fariborz Jahaniana8139732011-06-23 23:16:19 +00005@interface INTF :SUPER // expected-error {{attempting to use the forward class 'SUPER' as superclass of 'INTF'}}
Fariborz Jahanian1d5b0e32007-09-20 17:54:07 +00006@end
7
8@interface SUPER @end
9
Chris Lattnerb8b96af2008-11-23 22:46:27 +000010@interface INTF1 : SUPER // expected-note {{previous definition is here}}
Fariborz Jahanian1d5b0e32007-09-20 17:54:07 +000011@end
12
13@interface INTF2 : INTF1
14@end
15
Fariborz Jahaniana8139732011-06-23 23:16:19 +000016@interface INTF3 : Y // expected-error {{attempting to use the forward class 'Y' as superclass of 'INTF3'}} \
Douglas Gregora6f26382010-01-06 23:44:25 +000017 // expected-note{{'INTF3' declared here}}
Fariborz Jahanian1d5b0e32007-09-20 17:54:07 +000018@end
19
Chris Lattnerb8b96af2008-11-23 22:46:27 +000020@interface INTF1 // expected-error {{duplicate interface definition for class 'INTF1'}}
Fariborz Jahanian1d5b0e32007-09-20 17:54:07 +000021@end
Steve Naroff95110962008-03-28 21:37:05 +000022
23@implementation SUPER
24- (void)dealloc {
Ted Kremeneke00909a2011-01-23 17:21:34 +000025 [super dealloc]; // expected-error {{'SUPER' cannot use 'super' because it is a root class}}
Steve Naroff95110962008-03-28 21:37:05 +000026}
27@end
Fariborz Jahanianfdee0892009-07-09 22:08:26 +000028
29@interface RecursiveClass : RecursiveClass // expected-error {{trying to recursively use 'RecursiveClass' as superclass of 'RecursiveClass'}}
30@end
31
32@implementation RecursiveClass
33@end
34
Douglas Gregor95ff7422010-01-04 17:27:12 +000035@implementation iNTF3 // expected-warning{{cannot find interface declaration for 'iNTF3'; did you mean 'INTF3'?}}
36@end