blob: 7931cc3fdce49f8e597d96126482e03e5795e5e4 [file] [log] [blame]
Eli Friedman81e4e4e2013-06-21 02:09:51 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
Fariborz Jahanianc9cd8a12007-10-04 00:22:33 +00002
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +00003@protocol SUPER;
4
Chris Lattner9c1842b2008-07-26 03:47:43 +00005@interface SUPER <SUPER> @end // expected-warning {{cannot find protocol definition for 'SUPER'}}
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +00006
Chris Lattner0369c572008-11-23 23:12:31 +00007typedef int INTF; // expected-note {{previous definition is here}}
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +00008
9@interface INTF @end // expected-error {{redefinition of 'INTF' as different kind of symbol}}
10
Chris Lattner0369c572008-11-23 23:12:31 +000011@interface OBJECT @end // expected-note {{previous definition is here}}
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +000012
Chris Lattnere6447ef2008-11-23 22:46:27 +000013@interface INTF1 : OBJECT @end // expected-note {{previous definition is here}}
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +000014
Chris Lattnere6447ef2008-11-23 22:46:27 +000015@interface INTF1 : OBJECT @end // expected-error {{duplicate interface definition for class 'INTF1'}}
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +000016
Douglas Gregor75a45ba2009-02-16 17:45:42 +000017typedef int OBJECT; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +000018
Eli Friedman81e4e4e2013-06-21 02:09:51 +000019typedef int OBJECT2; // expected-note 2 {{previous definition is here}}
Douglas Gregor75a45ba2009-02-16 17:45:42 +000020@interface INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +000021
Eli Friedman81e4e4e2013-06-21 02:09:51 +000022@implementation INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
Fariborz Jahanianbfe13c52007-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 Naroff189d41f2009-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 Gregor11bb30842011-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