Steve Naroff | 08f1967 | 2008-01-13 17:10:08 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify -std=c90 %s |
| 2 | void |
| 3 | foo (void) |
| 4 | { |
| 5 | struct b; |
| 6 | struct b* x = 0; |
| 7 | struct b* y = &*x; |
| 8 | } |
| 9 | |
| 10 | void foo2 (void) |
| 11 | { |
| 12 | typedef int (*arrayptr)[]; |
| 13 | arrayptr x = 0; |
| 14 | arrayptr y = &*x; |
| 15 | } |
| 16 | |
| 17 | void foo3 (void) |
| 18 | { |
| 19 | void* x = 0; |
Steve Naroff | acb818a | 2008-02-10 01:39:04 +0000 | [diff] [blame] | 20 | void* y = &*x; // expected-error{{address expression must be an lvalue or a function designator}} |
Steve Naroff | 75ceedf | 2008-02-10 00:30:18 +0000 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | extern const void cv1; |
Steve Naroff | a0992b6 | 2008-02-18 15:14:59 +0000 | [diff] [blame] | 24 | |
Steve Naroff | 75ceedf | 2008-02-10 00:30:18 +0000 | [diff] [blame] | 25 | const void *foo4 (void) |
| 26 | { |
| 27 | return &cv1; |
Steve Naroff | 08f1967 | 2008-01-13 17:10:08 +0000 | [diff] [blame] | 28 | } |
| 29 | |
Steve Naroff | acb818a | 2008-02-10 01:39:04 +0000 | [diff] [blame] | 30 | extern void cv2; |
| 31 | void *foo5 (void) |
| 32 | { |
| 33 | return &cv2; // expected-error{{address expression must be an lvalue or a function designator}} |
| 34 | } |
Steve Naroff | a0992b6 | 2008-02-18 15:14:59 +0000 | [diff] [blame] | 35 | |
| 36 | typedef const void CVT; |
| 37 | extern CVT cv3; |
| 38 | |
| 39 | const void *foo6 (void) |
| 40 | { |
| 41 | return &cv3; |
| 42 | } |
| 43 | |