The following code fails to compile:
struct Foo {
int x;
};
const Foo var = { 3 };
static assert(var.x == 3);
That is, you cannot make assertions about the values of members of const
structs. Does anybody know whether this is a bug in the compiler, or
just a missing feature in the language? It seems like this would be
easy enough to implement, and if it worked my compile-time string
tokenizer would be a lot easier to write!