With the following code,
#define REINT(T, X) (union {__typeof__(X) x; T t;}){X}.t
int f2i(float x) {
return REINT(int, x);
}
float i2f(int x) {
return REINT(float, x);
}
float f2i2f(float x) {
return REINT(float, REINT(int, x));
}
Clang complains about f2i2f
that an "initializer element is not a compile-time constant". This seems odd because compound literals "have automatic storage duration associated with
the enclosing block" (6.5.2.5p5), and the elements in the initializer list for such objects don't have to be compile-time constants.