Daniel Dunbar | 40ca814 | 2008-08-05 06:30:41 +0000 | [diff] [blame] | 1 | // RUN: clang -verify -emit-llvm -o %t %s |
Eli Friedman | 05d125c | 2008-02-21 18:07:36 +0000 | [diff] [blame] | 2 | |
| 3 | #include <stdint.h> |
| 4 | |
| 5 | // Brace-enclosed string array initializers |
| 6 | char a[] = { "asdf" }; |
| 7 | |
| 8 | // Double-implicit-conversions of array/functions (not legal C, but |
| 9 | // clang accepts it for gcc compat). |
Daniel Dunbar | 40ca814 | 2008-08-05 06:30:41 +0000 | [diff] [blame] | 10 | intptr_t b = a; // expected-warning {{incompatible pointer to integer conversion}} |
Eli Friedman | 05d125c | 2008-02-21 18:07:36 +0000 | [diff] [blame] | 11 | int c(); |
| 12 | void *d = c; |
Daniel Dunbar | 40ca814 | 2008-08-05 06:30:41 +0000 | [diff] [blame] | 13 | intptr_t e = c; // expected-warning {{incompatible pointer to integer conversion}} |
Eli Friedman | a36799c | 2008-05-29 11:22:45 +0000 | [diff] [blame] | 14 | |
| 15 | int f, *g = __extension__ &f, *h = (1 != 1) ? &f : &f; |
Anders Carlsson | 13c623d | 2008-11-22 06:42:54 +0000 | [diff] [blame] | 16 | |
| 17 | union s2 { |
| 18 | struct { |
| 19 | struct { } *f0; |
| 20 | } f0; |
| 21 | }; |
| 22 | |
| 23 | int g0 = (int)(&(((union s2 *) 0)->f0.f0) - 0); |