1651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// RUN: %clang_cc1 -fsyntax-only -verify -Wno-bool-conversion %s 2578a97249c10eb83f25b408de1edfb70f5a4233cEli Friedman 356bddeda24adcb927dd5ceafd75f84ebc2eb4203Daniel Dunbartypedef __typeof((int*) 0 - (int*) 0) intptr_t; 4578a97249c10eb83f25b408de1edfb70f5a4233cEli Friedman 51a86b33c1870fee08d281c9f07ac1280195a7faeAnders Carlssonstatic int f = 10; 6d8803632d248a360a040ff03eff1162988058036Chris Lattnerstatic int b = f; // expected-error {{initializer element is not a compile-time constant}} 7c1cc6dccd42b91a2ebb397415940da91dbf36103Eli Friedman 841826bb59d2ef5e8c8a4a0cd2b06a7a011b67b4dEli Friedmanfloat r = (float) (intptr_t) &r; // expected-error {{initializer element is not a compile-time constant}} 9578a97249c10eb83f25b408de1edfb70f5a4233cEli Friedmanintptr_t s = (intptr_t) &s; 10c1cc6dccd42b91a2ebb397415940da91dbf36103Eli Friedman_Bool t = &t; 11839508150a7a595b6172217eeddc4d024fc201c5Nuno Lopes 12839508150a7a595b6172217eeddc4d024fc201c5Nuno Lopes 13839508150a7a595b6172217eeddc4d024fc201c5Nuno Lopesunion bar { 141eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump int i; 15839508150a7a595b6172217eeddc4d024fc201c5Nuno Lopes}; 16839508150a7a595b6172217eeddc4d024fc201c5Nuno Lopes 17839508150a7a595b6172217eeddc4d024fc201c5Nuno Lopesstruct foo { 1814b94366a829d2ed1b1b6d5cec1bb83aad9aeca2Eli Friedman short ptr; 19839508150a7a595b6172217eeddc4d024fc201c5Nuno Lopes}; 20839508150a7a595b6172217eeddc4d024fc201c5Nuno Lopes 21839508150a7a595b6172217eeddc4d024fc201c5Nuno Lopesunion bar u[1]; 226bd9719fd97abac1b8126eae866e96db88be4ac8Eli Friedmanstruct foo x = {(intptr_t) u}; // expected-error {{initializer element is not a compile-time constant}} 23ff77645058c5d56b4f3273e27f7492c78288825eNuno Lopesstruct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}} 246bd9719fd97abac1b8126eae866e96db88be4ac8Eli Friedmanintptr_t z = (intptr_t) u; // no-error 25