2012-04-07 02:12:22 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
|
2007-10-16 03:16:57 +08:00
|
|
|
|
2008-11-24 07:12:31 +08:00
|
|
|
@interface Foo // expected-note {{previous definition is here}}
|
2007-10-16 03:16:57 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
float Foo; // expected-error {{redefinition of 'Foo' as different kind of symbol}}
|
|
|
|
|
2008-11-24 07:12:31 +08:00
|
|
|
@class Bar; // expected-note {{previous definition is here}}
|
2007-10-16 03:16:57 +08:00
|
|
|
|
|
|
|
typedef int Bar; // expected-error {{redefinition of 'Bar' as different kind of symbol}}
|
|
|
|
|
|
|
|
@implementation FooBar // expected-warning {{cannot find interface declaration for 'FooBar'}}
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
2008-11-24 07:12:31 +08:00
|
|
|
typedef int OBJECT; // expected-note {{previous definition is here}}
|
2007-10-16 03:16:57 +08:00
|
|
|
|
|
|
|
@class OBJECT ; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
|
|
|
|
|
|
|
|
|
2009-04-23 23:15:40 +08:00
|
|
|
typedef int Gorf; // expected-note {{previous definition is here}}
|
2007-10-16 03:16:57 +08:00
|
|
|
|
2009-04-23 23:15:40 +08:00
|
|
|
@interface Gorf @end // expected-error {{redefinition of 'Gorf' as different kind of symbol}} expected-note {{previous definition is here}}
|
2007-10-16 03:16:57 +08:00
|
|
|
|
|
|
|
void Gorf() // expected-error {{redefinition of 'Gorf' as different kind of symbol}}
|
|
|
|
{
|
2009-02-08 03:52:04 +08:00
|
|
|
int Bar, Foo, FooBar;
|
2007-10-16 03:16:57 +08:00
|
|
|
}
|
2008-11-19 03:15:30 +08:00
|
|
|
|
|
|
|
@protocol P -im1; @end
|
|
|
|
@protocol Q -im2; @end
|
2008-11-24 06:46:27 +08:00
|
|
|
@interface A<P> @end // expected-note {{previous definition is here}}
|
|
|
|
@interface A<Q> @end // expected-error {{duplicate interface definition for class 'A'}}
|
2008-11-19 03:15:30 +08:00
|
|
|
|
2008-11-24 06:46:27 +08:00
|
|
|
@protocol PP<P> @end // expected-note {{previous definition is here}}
|
2009-04-07 07:43:32 +08:00
|
|
|
@protocol PP<Q> @end // expected-warning {{duplicate protocol definition of 'PP'}}
|
2008-11-19 03:15:30 +08:00
|
|
|
|
2016-11-11 02:30:26 +08:00
|
|
|
@protocol DP<P> @end
|
|
|
|
#pragma clang diagnostic push
|
|
|
|
#pragma clang diagnostic ignored "-Wduplicate-protocol"
|
|
|
|
@protocol DP<Q> @end
|
|
|
|
#pragma clang diagnostic pop
|
|
|
|
|
2008-11-24 06:38:38 +08:00
|
|
|
@interface A(Cat)<P> @end // expected-note {{previous definition is here}}
|
|
|
|
@interface A(Cat)<Q> @end // expected-warning {{duplicate definition of category 'Cat' on interface 'A'}}
|
2010-03-06 06:42:55 +08:00
|
|
|
|
|
|
|
// rdar 7626768
|
|
|
|
@class NSString;
|
|
|
|
NSString * TestBaz; // expected-note {{previous definition is here}}
|
|
|
|
NSString * const TestBaz; // expected-error {{redefinition of 'TestBaz' with a different type}}
|