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 3 4@interface Foo // expected-note {{previous definition is here}} 5@end 6 7float Foo; // expected-error {{redefinition of 'Foo' as different kind of symbol}} 8 9@class Bar; // expected-note {{previous definition is here}} 10 11typedef int Bar; // expected-error {{redefinition of 'Bar' as different kind of symbol}} 12 13@implementation FooBar // expected-warning {{cannot find interface declaration for 'FooBar'}} 14@end 15 16 17typedef int OBJECT; // expected-note {{previous definition is here}} 18 19@class OBJECT ; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}} 20 21 22typedef int Gorf; // expected-note {{previous definition is here}} 23 24@interface Gorf @end // expected-error {{redefinition of 'Gorf' as different kind of symbol}} expected-note {{previous definition is here}} 25 26void Gorf(void) // expected-error {{redefinition of 'Gorf' as different kind of symbol}} 27{ 28 int Bar, Foo, FooBar; 29} 30 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'}} 35 36@protocol PP<P> @end // expected-note {{previous definition is here}} 37@protocol PP<Q> @end // expected-warning {{duplicate protocol definition of 'PP'}} 38 39@protocol DP<P> @end 40#pragma clang diagnostic push 41#pragma clang diagnostic ignored "-Wduplicate-protocol" 42@protocol DP<Q> @end 43#pragma clang diagnostic pop 44 45@interface A(Cat)<P> @end 46@interface A(Cat)<Q> @end 47 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'}} 51#endif 52 53@class NSString; 54NSString * TestBaz; // expected-note {{previous definition is here}} 55NSString * const TestBaz; // expected-error {{redefinition of 'TestBaz' with a different type}} 56