blob: 7a2cd40424d3cfc834869d059a50b23682f48d82 [file] [log] [blame]
Patrick Beardacfbe9e2012-04-06 18:12:22 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
Fariborz Jahaniand4b30152007-10-15 19:16:57 +00002
Chris Lattner0369c572008-11-23 23:12:31 +00003@interface Foo // expected-note {{previous definition is here}}
Fariborz Jahaniand4b30152007-10-15 19:16:57 +00004@end
5
6float Foo; // expected-error {{redefinition of 'Foo' as different kind of symbol}}
7
Chris Lattner0369c572008-11-23 23:12:31 +00008@class Bar; // expected-note {{previous definition is here}}
Fariborz Jahaniand4b30152007-10-15 19:16:57 +00009
10typedef 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
Chris Lattner0369c572008-11-23 23:12:31 +000016typedef int OBJECT; // expected-note {{previous definition is here}}
Fariborz Jahaniand4b30152007-10-15 19:16:57 +000017
18@class OBJECT ; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
19
20
Steve Naroff3c301dc2009-04-23 15:15:40 +000021typedef int Gorf; // expected-note {{previous definition is here}}
Fariborz Jahaniand4b30152007-10-15 19:16:57 +000022
Steve Naroff3c301dc2009-04-23 15:15:40 +000023@interface Gorf @end // expected-error {{redefinition of 'Gorf' as different kind of symbol}} expected-note {{previous definition is here}}
Fariborz Jahaniand4b30152007-10-15 19:16:57 +000024
25void Gorf() // expected-error {{redefinition of 'Gorf' as different kind of symbol}}
26{
Sebastian Redl2175b6a2009-02-07 19:52:04 +000027 int Bar, Foo, FooBar;
Fariborz Jahaniand4b30152007-10-15 19:16:57 +000028}
Steve Naroff119f60e2008-11-18 19:15:30 +000029
30@protocol P -im1; @end
31@protocol Q -im2; @end
Chris Lattnere6447ef2008-11-23 22:46:27 +000032@interface A<P> @end // expected-note {{previous definition is here}}
33@interface A<Q> @end // expected-error {{duplicate interface definition for class 'A'}}
Steve Naroff119f60e2008-11-18 19:15:30 +000034
Chris Lattnere6447ef2008-11-23 22:46:27 +000035@protocol PP<P> @end // expected-note {{previous definition is here}}
Fariborz Jahanian54d569c2009-04-06 23:43:32 +000036@protocol PP<Q> @end // expected-warning {{duplicate protocol definition of 'PP'}}
Steve Naroff119f60e2008-11-18 19:15:30 +000037
Alex Lorenza5430bd2016-11-10 18:30:26 +000038@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
Chris Lattner88dcd2a2008-11-23 22:38:38 +000044@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'}}
Fariborz Jahaniand2bccaf2010-03-05 22:42:55 +000046
47// rdar 7626768
48@class NSString;
49NSString * TestBaz; // expected-note {{previous definition is here}}
50NSString * const TestBaz; // expected-error {{redefinition of 'TestBaz' with a different type}}