The code below fails to compile with "initializer element is not constant", or similar on gcc and clang.
Is there any way to make z even more constant? It's already a static constant pointer to constant characters.
Can this be made to work (in a standards compliant way) or is it a violation of the standard?
static const char * const z = "1234";
const struct {
const char * a;
} b = {z};
My specific use case is closer to
const struct {
char x[5];
char y[5];
} n = {"12345","abcde"};
static const char * const z = n.x;
const struct {
const char * a;
} b = {z};
Actually I'd be happier if I could define an alias, something like this
const char z[5] = n.x;
which is bad syntax, but ....