Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s -pedantic |
Chris Lattner | da46f3b | 2008-01-25 19:37:24 +0000 | [diff] [blame] | 2 | // rdar://5707001 |
| 3 | |
| 4 | @interface NSNumber; |
| 5 | - () METH; |
Chris Lattner | b93fb49 | 2008-06-02 21:31:07 +0000 | [diff] [blame] | 6 | - (unsigned) METH2; |
Chris Lattner | da46f3b | 2008-01-25 19:37:24 +0000 | [diff] [blame] | 7 | @end |
| 8 | |
Chris Lattner | 0fc73f7 | 2008-10-26 23:29:41 +0000 | [diff] [blame] | 9 | struct SomeStruct { |
| 10 | int x, y, z, q; |
| 11 | }; |
| 12 | |
Chris Lattner | 5c74942 | 2008-01-25 19:43:26 +0000 | [diff] [blame] | 13 | void test1() { |
Chris Lattner | da46f3b | 2008-01-25 19:37:24 +0000 | [diff] [blame] | 14 | id objects[] = {[NSNumber METH]}; |
Chris Lattner | 5c74942 | 2008-01-25 19:43:26 +0000 | [diff] [blame] | 15 | } |
| 16 | |
Chris Lattner | 2dd979f | 2009-04-11 19:08:56 +0000 | [diff] [blame] | 17 | void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value}} |
Steve Naroff | ccef371 | 2009-02-20 22:59:16 +0000 | [diff] [blame] | 18 | id objects[] = {[x METH]}; |
Chris Lattner | 2b1cc8b | 2008-07-21 06:12:56 +0000 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | void test3(NSNumber *x) { |
Chris Lattner | 5c74942 | 2008-01-25 19:43:26 +0000 | [diff] [blame] | 22 | id objects[] = {[x METH]}; |
Chris Lattner | da46f3b | 2008-01-25 19:37:24 +0000 | [diff] [blame] | 23 | } |
| 24 | |
Chris Lattner | 5c74942 | 2008-01-25 19:43:26 +0000 | [diff] [blame] | 25 | |
Chris Lattner | b93fb49 | 2008-06-02 21:31:07 +0000 | [diff] [blame] | 26 | // rdar://5977581 |
Chris Lattner | 2b1cc8b | 2008-07-21 06:12:56 +0000 | [diff] [blame] | 27 | void test4() { |
Chris Lattner | b93fb49 | 2008-06-02 21:31:07 +0000 | [diff] [blame] | 28 | unsigned x[] = {[NSNumber METH2]+2}; |
| 29 | } |
| 30 | |
Chris Lattner | 0fc73f7 | 2008-10-26 23:29:41 +0000 | [diff] [blame] | 31 | void test5(NSNumber *x) { |
| 32 | unsigned y[] = { |
| 33 | [4][NSNumber METH2]+2, // expected-warning {{use of GNU 'missing =' extension in designator}} |
| 34 | [4][x METH2]+2 // expected-warning {{use of GNU 'missing =' extension in designator}} |
| 35 | }; |
| 36 | |
| 37 | struct SomeStruct z = { |
| 38 | .x = [x METH2], // ok. |
| 39 | .x [x METH2] // expected-error {{expected '=' or another designator}} |
| 40 | }; |
| 41 | } |
Fariborz Jahanian | d3fdcb5 | 2009-11-06 21:48:47 +0000 | [diff] [blame^] | 42 | |
| 43 | // rdar://7370882 |
| 44 | @interface SemicolonsAppDelegate |
| 45 | { |
| 46 | id i; |
| 47 | } |
| 48 | @property (assign) id window; |
| 49 | @end |
| 50 | |
| 51 | @implementation SemicolonsAppDelegate |
| 52 | { |
| 53 | id i; |
| 54 | } |
| 55 | @synthesize window; |
| 56 | @end |
| 57 | |
| 58 | |
| 59 | |