2010-02-18 03:26:59 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-02-22 14:45:27 +08:00
|
|
|
|
2010-02-18 03:26:59 +08:00
|
|
|
typedef __typeof((int*) 0 - (int*) 0) intptr_t;
|
2009-02-22 14:45:27 +08:00
|
|
|
|
2007-10-17 08:52:43 +08:00
|
|
|
static int f = 10;
|
2008-08-10 09:58:45 +08:00
|
|
|
static int b = f; // expected-error {{initializer element is not a compile-time constant}}
|
2008-05-31 02:14:48 +08:00
|
|
|
|
2009-05-01 10:23:58 +08:00
|
|
|
float r = (float) (intptr_t) &r; // expected-error {{initializer element is not a compile-time constant}}
|
2009-02-22 14:45:27 +08:00
|
|
|
intptr_t s = (intptr_t) &s;
|
2008-05-31 02:14:48 +08:00
|
|
|
_Bool t = &t;
|
2009-02-03 00:07:41 +08:00
|
|
|
|
|
|
|
|
|
|
|
union bar {
|
2009-09-09 23:08:12 +08:00
|
|
|
int i;
|
2009-02-03 00:07:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct foo {
|
2009-09-09 23:08:12 +08:00
|
|
|
unsigned ptr;
|
2009-02-03 00:07:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
union bar u[1];
|
2009-02-22 14:45:27 +08:00
|
|
|
struct foo x = {(intptr_t) u}; // no-error
|
2009-02-03 06:57:15 +08:00
|
|
|
struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}}
|