blob: 98a887ecab1f6c5767d7cfac89fbeceb72b4ab56 [file] [log] [blame]
Eli Friedmana9f39582013-06-21 02:09:51 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
Fariborz Jahanian4b6df3f2007-10-04 00:22:33 +00002
Stephen Hines651f13c2014-04-23 16:59:28 -07003@protocol SUPER; // expected-note {{protocol 'SUPER' has no definition}}
Fariborz Jahanianccb4f312007-09-25 18:38:09 +00004
Chris Lattnereacc3922008-07-26 03:47:43 +00005@interface SUPER <SUPER> @end // expected-warning {{cannot find protocol definition for 'SUPER'}}
Fariborz Jahanianccb4f312007-09-25 18:38:09 +00006
Chris Lattner5f4a6822008-11-23 23:12:31 +00007typedef int INTF; // expected-note {{previous definition is here}}
Fariborz Jahanianccb4f312007-09-25 18:38:09 +00008
9@interface INTF @end // expected-error {{redefinition of 'INTF' as different kind of symbol}}
10
Chris Lattner5f4a6822008-11-23 23:12:31 +000011@interface OBJECT @end // expected-note {{previous definition is here}}
Fariborz Jahanianccb4f312007-09-25 18:38:09 +000012
Chris Lattnerb8b96af2008-11-23 22:46:27 +000013@interface INTF1 : OBJECT @end // expected-note {{previous definition is here}}
Fariborz Jahanianccb4f312007-09-25 18:38:09 +000014
Chris Lattnerb8b96af2008-11-23 22:46:27 +000015@interface INTF1 : OBJECT @end // expected-error {{duplicate interface definition for class 'INTF1'}}
Fariborz Jahanianccb4f312007-09-25 18:38:09 +000016
Douglas Gregorcda9c672009-02-16 17:45:42 +000017typedef int OBJECT; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
Fariborz Jahanianccb4f312007-09-25 18:38:09 +000018
Eli Friedmana9f39582013-06-21 02:09:51 +000019typedef int OBJECT2; // expected-note 2 {{previous definition is here}}
Douglas Gregorcda9c672009-02-16 17:45:42 +000020@interface INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
Fariborz Jahanianccb4f312007-09-25 18:38:09 +000021
Eli Friedmana9f39582013-06-21 02:09:51 +000022@implementation INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
Fariborz Jahanianccb4f312007-09-25 18:38:09 +000023
24@protocol PROTO;
25
26@interface INTF3 : PROTO @end // expected-error {{cannot find interface declaration for 'PROTO', superclass of 'INTF3'}}
27
Steve Naroff818cb9e2009-02-04 17:14:05 +000028// Make sure we allow the following (for GCC compatibility).
29@interface NSObject @end
30typedef NSObject TD_NSObject;
31@interface XCElementUnit : TD_NSObject {}
32@end
33
Douglas Gregora38c4732011-12-01 15:37:53 +000034// Make sure we don't typo-correct to ourselves.
35@interface SomeClassSub : SomeClassSup // expected-error{{cannot find interface declaration for 'SomeClassSup', superclass of 'SomeClassSub'}}
36@end