xref: /aosp_15_r20/external/clang/test/SemaObjC/check-dup-objc-decls-1.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2*67e74705SXin Li
3*67e74705SXin Li@interface Foo // expected-note {{previous definition is here}}
4*67e74705SXin Li@end
5*67e74705SXin Li
6*67e74705SXin Lifloat Foo;	// expected-error {{redefinition of 'Foo' as different kind of symbol}}
7*67e74705SXin Li
8*67e74705SXin Li@class Bar;  // expected-note {{previous definition is here}}
9*67e74705SXin Li
10*67e74705SXin Litypedef int Bar;  // expected-error {{redefinition of 'Bar' as different kind of symbol}}
11*67e74705SXin Li
12*67e74705SXin Li@implementation FooBar // expected-warning {{cannot find interface declaration for 'FooBar'}}
13*67e74705SXin Li@end
14*67e74705SXin Li
15*67e74705SXin Li
16*67e74705SXin Litypedef int OBJECT; // expected-note {{previous definition is here}}
17*67e74705SXin Li
18*67e74705SXin Li@class OBJECT ;	// expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
19*67e74705SXin Li
20*67e74705SXin Li
21*67e74705SXin Litypedef int Gorf;  // expected-note {{previous definition is here}}
22*67e74705SXin Li
23*67e74705SXin Li@interface Gorf @end // expected-error {{redefinition of 'Gorf' as different kind of symbol}} expected-note {{previous definition is here}}
24*67e74705SXin Li
25*67e74705SXin Livoid Gorf() // expected-error {{redefinition of 'Gorf' as different kind of symbol}}
26*67e74705SXin Li{
27*67e74705SXin Li  int Bar, Foo, FooBar;
28*67e74705SXin Li}
29*67e74705SXin Li
30*67e74705SXin Li@protocol P -im1; @end
31*67e74705SXin Li@protocol Q -im2; @end
32*67e74705SXin Li@interface A<P> @end  // expected-note {{previous definition is here}}
33*67e74705SXin Li@interface A<Q> @end  // expected-error {{duplicate interface definition for class 'A'}}
34*67e74705SXin Li
35*67e74705SXin Li@protocol PP<P> @end  // expected-note {{previous definition is here}}
36*67e74705SXin Li@protocol PP<Q> @end  // expected-warning {{duplicate protocol definition of 'PP'}}
37*67e74705SXin Li
38*67e74705SXin Li@interface A(Cat)<P> @end // expected-note {{previous definition is here}}
39*67e74705SXin Li@interface A(Cat)<Q> @end // expected-warning {{duplicate definition of category 'Cat' on interface 'A'}}
40*67e74705SXin Li
41*67e74705SXin Li// rdar 7626768
42*67e74705SXin Li@class NSString;
43*67e74705SXin LiNSString * TestBaz;  // expected-note {{previous definition is here}}
44*67e74705SXin LiNSString * const TestBaz;  // expected-error {{redefinition of 'TestBaz' with a different type}}
45