| Chris Lattner | 3b427b3 | 2007-10-11 00:18:28 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s | 
| Chris Lattner | 1e45efa | 2007-08-28 16:20:14 +0000 | [diff] [blame] | 2 |  | 
 | 3 | void *test1(void) { return 0; } | 
 | 4 |  | 
| Eli Friedman | 5101907 | 2008-02-06 22:48:16 +0000 | [diff] [blame] | 5 | void test2 (const struct {int a;} *x) { | 
 | 6 |   x->a = 10; // expected-error {{read-only variable is not assignable}} | 
 | 7 | } | 
| Steve Naroff | 336ed0b | 2008-02-09 16:59:44 +0000 | [diff] [blame] | 8 |  | 
 | 9 | typedef int arr[10]; | 
 | 10 | void test3() { | 
 | 11 |   const arr b; | 
 | 12 |   const int b2[10];  | 
 | 13 |   b[4] = 1; // expected-error {{read-only variable is not assignable}} | 
 | 14 |   b2[4] = 1; // expected-error {{read-only variable is not assignable}} | 
 | 15 | } |