Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -fsyntax-only -verify |
Chris Lattner | 8a93423 | 2008-03-31 00:36:02 +0000 | [diff] [blame] | 2 | |
| 3 | @interface Test { |
| 4 | int x; |
| 5 | } |
| 6 | |
| 7 | -(void) setX: (int) d; |
| 8 | @end |
| 9 | |
| 10 | extern struct foo x; |
| 11 | |
| 12 | @implementation Test |
| 13 | |
| 14 | -(void) setX: (int) n { |
| 15 | x = n; |
| 16 | } |
| 17 | |
| 18 | @end |
Douglas Gregor | d7174f2 | 2010-04-19 19:10:40 +0000 | [diff] [blame] | 19 | |
| 20 | @interface Ivar |
| 21 | - (float*)method; |
| 22 | @end |
| 23 | |
| 24 | @interface A { |
| 25 | A *Ivar; |
| 26 | } |
| 27 | - (int*)method; |
| 28 | @end |
| 29 | |
| 30 | @implementation A |
| 31 | - (int*)method { |
| 32 | int *ip = [Ivar method]; // expected-warning{{warning: incompatible pointer types initializing 'int *' with an expression of type 'float *'}} |
| 33 | // Note that there is no warning in Objective-C++ |
| 34 | return 0; |
| 35 | } |
| 36 | @end |
| 37 | |