]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaObjC/check-dup-objc-decls-1.m
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / SemaObjC / check-dup-objc-decls-1.m
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2
3 @interface Foo // expected-note {{previous definition is here}}
4 @end
5
6 float Foo;      // expected-error {{redefinition of 'Foo' as different kind of symbol}}
7
8 @class Bar;  // expected-note {{previous definition is here}}
9
10 typedef int Bar;  // expected-error {{redefinition of 'Bar' as different kind of symbol}}
11
12 @implementation FooBar // expected-warning {{cannot find interface declaration for 'FooBar'}} 
13 @end
14
15
16 typedef int OBJECT; // expected-note {{previous definition is here}}
17
18 @class OBJECT ; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
19
20
21 typedef int Gorf;  // expected-note {{previous definition is here}}
22
23 @interface Gorf @end // expected-error {{redefinition of 'Gorf' as different kind of symbol}} expected-note {{previous definition is here}}
24
25 void Gorf() // expected-error {{redefinition of 'Gorf' as different kind of symbol}}
26 {
27   int Bar, Foo, FooBar;
28 }
29
30 @protocol P -im1; @end
31 @protocol Q -im2; @end
32 @interface A<P> @end  // expected-note {{previous definition is here}}
33 @interface A<Q> @end  // expected-error {{duplicate interface definition for class 'A'}}
34
35 @protocol PP<P> @end  // expected-note {{previous definition is here}}
36 @protocol PP<Q> @end  // expected-warning {{duplicate protocol definition of 'PP'}}
37
38 @protocol DP<P> @end
39 #pragma clang diagnostic push
40 #pragma clang diagnostic ignored "-Wduplicate-protocol"
41 @protocol DP<Q> @end
42 #pragma clang diagnostic pop
43
44 @interface A(Cat)<P> @end // expected-note {{previous definition is here}}
45 @interface A(Cat)<Q> @end // expected-warning {{duplicate definition of category 'Cat' on interface 'A'}}
46
47 // rdar 7626768
48 @class NSString;
49 NSString * TestBaz;  // expected-note {{previous definition is here}}
50 NSString * const TestBaz;  // expected-error {{redefinition of 'TestBaz' with a different type}}