blob: 0d114b99fb6db016066f51223d52994235fce6c7 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Fariborz Jahanian4b6df3f2007-10-04 00:22:33 +00002
Fariborz Jahanianccb4f312007-09-25 18:38:09 +00003@protocol SUPER;
4
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
Douglas Gregorcda9c672009-02-16 17:45:42 +000019typedef int OBJECT2; // expected-note {{previous definition is here}}
20@interface INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
Fariborz Jahanianccb4f312007-09-25 18:38:09 +000021
22
23@protocol PROTO;
24
25@interface INTF3 : PROTO @end // expected-error {{cannot find interface declaration for 'PROTO', superclass of 'INTF3'}}
26
Steve Naroff818cb9e2009-02-04 17:14:05 +000027// Make sure we allow the following (for GCC compatibility).
28@interface NSObject @end
29typedef NSObject TD_NSObject;
30@interface XCElementUnit : TD_NSObject {}
31@end
32
Douglas Gregora38c4732011-12-01 15:37:53 +000033// Make sure we don't typo-correct to ourselves.
34@interface SomeClassSub : SomeClassSup // expected-error{{cannot find interface declaration for 'SomeClassSup', superclass of 'SomeClassSub'}}
35@end