On Sat, 15 May 2010 16:15:23 -0400, strtr <[email protected]> wrote:
Should I report these bugs?
(and how should I call this first one?)
----
module main;
//const S S1 = S(); // uncomment this to compile
struct S
{
float value;
static S opCall()
{
S s;
return s;
}
const S S2 = S();
}
void main(){}
--
main.d(4): Error: struct main.S no size yet for forward reference
main.d(4): Error: struct main.S no size yet for forward reference
main.d(11): Error: cannot evaluate opCall() at compile time
----
Unlike some languages, D1 const does not imply static. Which means you
are trying to define an S as containing an S, which would then contain
another S and so on. This should work:
struct S
{
float value;
static S opCall()
{
S s;
return s;
}
static const S S2 = S();
}
-Steve