1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class -Wno-objc-duplicate-category-definition -DIGNORE_DUP_CAT %s
4 @interface Foo // expected-note {{previous definition is here}}
7 float Foo; // expected-error {{redefinition of 'Foo' as different kind of symbol}}
9 @class Bar; // expected-note {{previous definition is here}}
11 typedef int Bar; // expected-error {{redefinition of 'Bar' as different kind of symbol}}
13 @implementation FooBar // expected-warning {{cannot find interface declaration for 'FooBar'}}
17 typedef int OBJECT; // expected-note {{previous definition is here}}
19 @class OBJECT ; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
22 typedef int Gorf; // expected-note {{previous definition is here}}
24 @interface Gorf @end // expected-error {{redefinition of 'Gorf' as different kind of symbol}} expected-note {{previous definition is here}}
26 void Gorf(void) // expected-error {{redefinition of 'Gorf' as different kind of symbol}}
31 @protocol P -im1; @end
32 @protocol Q -im2; @end
33 @interface A<P> @end // expected-note {{previous definition is here}}
34 @interface A<Q> @end // expected-error {{duplicate interface definition for class 'A'}}
36 @protocol PP<P> @end // expected-note {{previous definition is here}}
37 @protocol PP<Q> @end // expected-warning {{duplicate protocol definition of 'PP'}}
40 #pragma clang diagnostic push
41 #pragma clang diagnostic ignored "-Wduplicate-protocol"
43 #pragma clang diagnostic pop
45 @interface A(Cat)<P> @end
46 @interface A(Cat)<Q> @end
48 #ifndef IGNORE_DUP_CAT
49 // expected-note@-4 {{previous definition is here}}
50 // expected-warning@-4 {{duplicate definition of category 'Cat' on interface 'A'}}
54 NSString * TestBaz; // expected-note {{previous definition is here}}
55 NSString * const TestBaz; // expected-error {{redefinition of 'TestBaz' with a different type}}