1// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -pedantic -Wno-objc-root-class %s 2// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-objc-root-class %s 3// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-objc-root-class -std=c++98 %s 4// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-objc-root-class -std=c++11 %s 5// rdar://5707001 6 7@interface NSNumber; 8- () METH; 9- (unsigned) METH2; 10@end 11 12struct SomeStruct { 13 int x, y, z, q; 14}; 15 16void test1() { 17 id objects[] = {[NSNumber METH]}; 18} 19 20void test2(NSNumber x) { // expected-error {{interface type 'NSNumber' cannot be passed by value; did you forget * in 'NSNumber'}} 21 id objects[] = {[x METH]}; 22} 23 24void test3(NSNumber *x) { 25 id objects[] = {[x METH]}; 26} 27 28 29// rdar://5977581 30void test4() { 31 unsigned x[] = {[NSNumber METH2]+2}; 32} 33 34void test5(NSNumber *x) { 35 unsigned y[] = { 36 [4][NSNumber METH2]+2, // expected-warning {{use of GNU 'missing =' extension in designator}} 37 [4][x METH2]+2 // expected-warning {{use of GNU 'missing =' extension in designator}} 38 }; 39 40 struct SomeStruct z = { 41 .x = [x METH2], // ok in C++98. 42#if __cplusplus >= 201103L 43 // expected-error@-2 {{non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list}} 44 // expected-note@-3 {{insert an explicit cast to silence this issue}} 45#endif 46 .x [x METH2] // expected-error {{expected '=' or another designator}} 47#if __cplusplus >= 201103L 48 // expected-error@-2 {{non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list}} 49 // expected-note@-3 {{insert an explicit cast to silence this issue}} 50#endif 51 }; 52} 53 54// rdar://7370882 55@interface SemicolonsAppDelegate 56{ 57 id i; 58} 59@property (assign) id window; 60@end 61 62@implementation SemicolonsAppDelegate 63{ 64 id i; 65} 66 @synthesize window=i; 67@end 68 69 70 71