Bug or Missing Feature? : Static assert about const structs

Russell Lewis webmaster at villagersonline.com
Tue Feb 27 10:36:38 PST 2007


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!


More information about the Digitalmars-d-bugs mailing list