brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 2caa4a8 Raw
68 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -pedantic -Wno-objc-root-class %s2// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-c99-designator -Wno-objc-root-class %s3// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-c99-designator -Wno-objc-root-class -std=c++98 %s4// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-c99-designator -Wno-objc-root-class -std=c++11 %s5 6@interface NSNumber;7- () METH;8- (unsigned) METH2;9@end10 11struct SomeStruct {12  int x, y, z, q;13};14 15void test1(void) {16	id objects[] = {[NSNumber METH]};17}18 19void test2(NSNumber x) { // expected-error {{interface type 'NSNumber' cannot be passed by value; did you forget * in 'NSNumber'}}20	id objects[] = {[x METH]};21}22 23void test3(NSNumber *x) {24	id objects[] = {[x METH]};25}26 27 28void test4(void) {29  unsigned x[] = {[NSNumber METH2]+2};30}31 32void test5(NSNumber *x) {33  unsigned y[] = {34    [4][NSNumber METH2]+2,   // expected-warning {{use of GNU 'missing =' extension in designator}}35    [4][x METH2]+2   // expected-warning {{use of GNU 'missing =' extension in designator}}36  };37  38  struct SomeStruct z = {39    .x = [x METH2], // ok in C++98.40#if __cplusplus >= 201103L41    // expected-error@-2 {{non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list}}42    // expected-note@-3 {{insert an explicit cast to silence this issue}}43#endif44    .x [x METH2]    // expected-error {{expected '=' or another designator}}45#if __cplusplus >= 201103L46    // expected-error@-2 {{non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list}}47    // expected-note@-3 {{insert an explicit cast to silence this issue}}48#endif49  };50}51 52@interface SemicolonsAppDelegate 53{54  id i;55}56@property (assign) id window;57@end58 59@implementation SemicolonsAppDelegate60{61  id i;62}63  @synthesize window=i;64@end65 66 67 68