Home | History | Annotate | Download | only in Parser
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic
      2 // RUN: %clang_cc1 -fsyntax-only -verify -x objective-c++ %s 
      3 // rdar://5707001
      4 
      5 @interface NSNumber;
      6 - () METH;
      7 - (unsigned) METH2;
      8 @end
      9 
     10 struct SomeStruct {
     11   int x, y, z, q;
     12 };
     13 
     14 void test1() {
     15 	id objects[] = {[NSNumber METH]};
     16 }
     17 
     18 void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value; did you forget * in 'NSNumber'}}
     19 	id objects[] = {[x METH]};
     20 }
     21 
     22 void test3(NSNumber *x) {
     23 	id objects[] = {[x METH]};
     24 }
     25 
     26 
     27 // rdar://5977581
     28 void test4() {
     29   unsigned x[] = {[NSNumber METH2]+2};
     30 }
     31 
     32 void 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.
     40     .x [x METH2]    // expected-error {{expected '=' or another designator}}
     41   };
     42 }
     43 
     44 // rdar://7370882
     45 @interface SemicolonsAppDelegate 
     46 {
     47   id i;
     48 }
     49 @property (assign) id window;
     50 @end
     51 
     52 @implementation SemicolonsAppDelegate
     53 {
     54   id i;
     55 }
     56   @synthesize window=i;
     57 @end
     58 
     59 
     60 
     61