xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/class-def-test-1.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2f4a2713aSLionel Sambuc
3*0a6a1f1dSLionel Sambuc@protocol SUPER; // expected-note {{protocol 'SUPER' has no definition}}
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambuc@interface SUPER <SUPER> @end // expected-warning {{cannot find protocol definition for 'SUPER'}}
6f4a2713aSLionel Sambuc
7f4a2713aSLionel Sambuctypedef int INTF; //  expected-note {{previous definition is here}}
8f4a2713aSLionel Sambuc
9f4a2713aSLionel Sambuc@interface INTF @end // expected-error {{redefinition of 'INTF' as different kind of symbol}}
10f4a2713aSLionel Sambuc
11f4a2713aSLionel Sambuc@interface OBJECT @end	// expected-note {{previous definition is here}}
12f4a2713aSLionel Sambuc
13f4a2713aSLionel Sambuc@interface INTF1 : OBJECT @end // expected-note {{previous definition is here}}
14f4a2713aSLionel Sambuc
15f4a2713aSLionel Sambuc@interface INTF1 : OBJECT @end // expected-error {{duplicate interface definition for class 'INTF1'}}
16f4a2713aSLionel Sambuc
17f4a2713aSLionel Sambuctypedef int OBJECT; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
18f4a2713aSLionel Sambuc
19f4a2713aSLionel Sambuctypedef int OBJECT2; // expected-note 2 {{previous definition is here}}
20f4a2713aSLionel Sambuc@interface INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
21f4a2713aSLionel Sambuc
22f4a2713aSLionel Sambuc@implementation INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
23f4a2713aSLionel Sambuc
24f4a2713aSLionel Sambuc@protocol PROTO;
25f4a2713aSLionel Sambuc
26f4a2713aSLionel Sambuc@interface INTF3 : PROTO @end // expected-error {{cannot find interface declaration for 'PROTO', superclass of 'INTF3'}}
27f4a2713aSLionel Sambuc
28f4a2713aSLionel Sambuc// Make sure we allow the following (for GCC compatibility).
29f4a2713aSLionel Sambuc@interface NSObject @end
30f4a2713aSLionel Sambuctypedef NSObject TD_NSObject;
31f4a2713aSLionel Sambuc@interface XCElementUnit : TD_NSObject {}
32f4a2713aSLionel Sambuc@end
33f4a2713aSLionel Sambuc
34f4a2713aSLionel Sambuc// Make sure we don't typo-correct to ourselves.
35f4a2713aSLionel Sambuc@interface SomeClassSub : SomeClassSup // expected-error{{cannot find interface declaration for 'SomeClassSup', superclass of 'SomeClassSub'}}
36f4a2713aSLionel Sambuc@end
37