Why isn't this expression const?

Brian Palmer d at brian.codekitchen.net
Fri May 11 14:36:35 PDT 2007


Stewart Gordon Wrote:

> "Brian Palmer" <d at brian.codekitchen.net> wrote in message 
> news:f1t6en$t32$1 at digitalmars.com...
> > This code won't compile:
> >
> > struct Vector3 { float x,y,z; }
> > const Vector3 ROT_FORCE_CCW = {0, 400_000, 0};
> > const Vector3 ROT_FORCE_CW  = {0, ROT_FORCE_CCW.y*-1, 0};
> <snip>
> > Am I doing something wrong, or is it just lack of compiler
> > smarts?  I'm using (gdc 0.23, using dmd 1.007)
> 
> It's the compiler getting confused.
> 
> http://d.puremagic.com/issues/show_bug.cgi?id=609
> 
> Stewart. 
> 

That clears things up. Thanks all for the great answers, I'll just work around it for now.



More information about the Digitalmars-d-learn mailing list