Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | b31cb7f | 2009-03-21 18:06:45 +0000 | [diff] [blame] | 2 | |
| 3 | @interface XX |
Steve Naroff | 8745416 | 2009-04-13 17:58:46 +0000 | [diff] [blame] | 4 | int x; // expected-error {{cannot declare variable inside @interface or @protocol}} |
| 5 | int one=1; // expected-error {{cannot declare variable inside @interface or @protocol}} |
Fariborz Jahanian | b31cb7f | 2009-03-21 18:06:45 +0000 | [diff] [blame] | 6 | @end |
| 7 | |
| 8 | @protocol PPP |
Steve Naroff | 8745416 | 2009-04-13 17:58:46 +0000 | [diff] [blame] | 9 | int ddd; // expected-error {{cannot declare variable inside @interface or @protocol}} |
Fariborz Jahanian | b31cb7f | 2009-03-21 18:06:45 +0000 | [diff] [blame] | 10 | @end |
| 11 | |
| 12 | @interface XX(CAT) |
Steve Naroff | 8745416 | 2009-04-13 17:58:46 +0000 | [diff] [blame] | 13 | char * III; // expected-error {{cannot declare variable inside @interface or @protocol}} |
Fariborz Jahanian | b31cb7f | 2009-03-21 18:06:45 +0000 | [diff] [blame] | 14 | extern int OK; |
| 15 | @end |
| 16 | |
Steve Naroff | 8745416 | 2009-04-13 17:58:46 +0000 | [diff] [blame] | 17 | @interface XX() |
| 18 | char * III2; // expected-error {{cannot declare variable inside @interface or @protocol}} |
| 19 | extern int OK2; |
| 20 | @end |
| 21 | |
Fariborz Jahanian | b31cb7f | 2009-03-21 18:06:45 +0000 | [diff] [blame] | 22 | |
| 23 | int main( int argc, const char *argv[] ) { |
| 24 | return x+one; |
| 25 | } |
| 26 | |