brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · b8245a5 Raw
68 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class -x objective-c++ %s3 4// Test decls inside Objective-C entities are considered to be duplicates of same-name decls outside of these entities.5 6@protocol SomeProtocol7struct InProtocol {}; // expected-note {{previous definition is here}}8- (union MethodReturnType { int x; float y; })returningMethod; // expected-note {{previous definition is here}}9#ifdef __cplusplus10// expected-error@-2 {{'MethodReturnType' cannot be defined in a parameter type}}11#endif12@end13 14@interface Container {15  struct InInterfaceCurliesWithField {} field; // expected-note {{previous definition is here}}16  union InInterfaceCurlies { int x; float y; }; // expected-note {{previous definition is here}}17}18enum InInterface { kX = 0, }; // expected-note {{previous definition is here}}19#ifdef __cplusplus20enum class InInterfaceScoped { kXScoped = 0, }; // expected-note {{previous definition is here}}21#endif22@end23 24@interface Container(Category)25union InCategory { int x; float y; }; // expected-note {{previous definition is here}}26@end27 28@interface Container() {29  enum InExtensionCurliesWithField: int { kY = 1, } extensionField; // expected-note {{previous definition is here}}30  struct InExtensionCurlies {}; // expected-note {{previous definition is here}}31}32union InExtension { int x; float y; }; // expected-note {{previous definition is here}}33@end34 35@implementation Container {36  union InImplementationCurliesWithField { int x; float y; } implField; // expected-note {{previous definition is here}}37  enum InImplementationCurlies { kZ = 2, }; // expected-note {{previous definition is here}}38}39struct InImplementation {}; // expected-note {{previous definition is here}}40@end41 42@implementation Container(Category)43enum InCategoryImplementation { kW = 3, }; // expected-note {{previous definition is here}}44@end45 46 47struct InProtocol { int a; }; // expected-error {{redefinition of 'InProtocol'}}48union MethodReturnType { int a; long b; }; // expected-error {{redefinition of 'MethodReturnType'}}49 50struct InInterfaceCurliesWithField { int a; }; // expected-error {{redefinition of 'InInterfaceCurliesWithField'}}51union InInterfaceCurlies { int a; long b; }; // expected-error {{redefinition of 'InInterfaceCurlies'}}52enum InInterface { kA = 10, }; // expected-error {{redefinition of 'InInterface'}}53#ifdef __cplusplus54enum class InInterfaceScoped { kAScoped = 10, }; // expected-error {{redefinition of 'InInterfaceScoped'}}55#endif56 57union InCategory { int a; long b; }; // expected-error {{redefinition of 'InCategory'}}58 59enum InExtensionCurliesWithField: int { kB = 11, }; // expected-error {{redefinition of 'InExtensionCurliesWithField'}}60struct InExtensionCurlies { int a; }; // expected-error {{redefinition of 'InExtensionCurlies'}}61union InExtension { int a; long b; }; // expected-error {{redefinition of 'InExtension'}}62 63union InImplementationCurliesWithField { int a; long b; }; // expected-error {{redefinition of 'InImplementationCurliesWithField'}}64enum InImplementationCurlies { kC = 12, }; // expected-error {{redefinition of 'InImplementationCurlies'}}65struct InImplementation { int a; }; // expected-error {{redefinition of 'InImplementation'}}66 67enum InCategoryImplementation { kD = 13, }; // expected-error {{redefinition of 'InCategoryImplementation'}}68