Anders Carlsson | 1a86b33 | 2007-10-17 00:52:43 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | static int f = 10; |
Chris Lattner | d880363 | 2008-08-10 01:58:45 +0000 | [diff] [blame] | 3 | static int b = f; // expected-error {{initializer element is not a compile-time constant}} |
Eli Friedman | c1cc6dc | 2008-05-30 18:14:48 +0000 | [diff] [blame] | 4 | |
Nuno Lopes | 8395081 | 2009-02-02 16:07:41 +0000 | [diff] [blame] | 5 | float r = (float) &r; // FIXME: should give an error: ptr value used where a float was expected |
Eli Friedman | c1cc6dc | 2008-05-30 18:14:48 +0000 | [diff] [blame] | 6 | long long s = (long long) &s; |
| 7 | _Bool t = &t; |
Nuno Lopes | 8395081 | 2009-02-02 16:07:41 +0000 | [diff] [blame] | 8 | |
| 9 | |
| 10 | union bar { |
| 11 | int i; |
| 12 | }; |
| 13 | |
| 14 | struct foo { |
| 15 | unsigned ptr; |
| 16 | }; |
| 17 | |
| 18 | union bar u[1]; |
Nuno Lopes | ff77645 | 2009-02-02 22:57:15 +0000 | [diff] [blame^] | 19 | struct foo x = {(long) u}; // no-error |
| 20 | struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}} |