digitalmars.D.bugs - bug? (forward reference)
- bobef <asd asd.asd> Apr 20 2007
- Sean Kelly <sean f4.ca> Apr 20 2007
- bobef <asd asd.asd> Apr 20 2007
- "Stewart Gordon" <smjg_1998 yahoo.com> Apr 22 2007
Is this a bug and if not what is it supposed to mean and why it doesn't work?
a.d(8): class a.B is forward referenced when looking for 'CONST1'
a.d(3): Error: no property 'CONST1' for type 'a.B'
a.d:
------------------------------------------------------------------
class A
{
static const CONST1=B.CONST1;
static const CONST2=2;
}
class B
{
static const CONST1=1;
static const CONST2=2;
}
void main()
{
}
Apr 20 2007
bobef wrote:Is this a bug and if not what is it supposed to mean and why it doesn't work?
It's a bug. The lookup mechanism currently doesn't seem to find anything declared within a class if the class is declared below the point it's referenced. I had a similar problem with an interface declared inside a class. Sean
Apr 20 2007
Yeah, me too, but I thought it was my mistake :) Sean Kelly Wrote:bobef wrote:Is this a bug and if not what is it supposed to mean and why it doesn't work?
It's a bug. The lookup mechanism currently doesn't seem to find anything declared within a class if the class is declared below the point it's referenced. I had a similar problem with an interface declared inside a class. Sean
Apr 20 2007
"bobef" <asd asd.asd> wrote in message news:f0a3gg$50r$1 digitalmars.com...Is this a bug and if not what is it supposed to mean and why it doesn't work?
Actually, it's a documented restriction: http://www.digitalmars.com/d/declaration.html#AutoDeclaration "The NonVoidInitializer cannot contain forward references (this restriction may be removed in the future)." That said, I'm wondering _what_ NonVoidInitializer! But it's certainly something that should be made to work. Stewart.
Apr 22 2007









bobef <asd asd.asd> 