Why can't typeof() be used in member method?

Andre Pany via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 26 06:51:05 PDT 2017


Hi,

I try to track down why some complex logic is not working. I 
think the root issue is that typeof() is not working in member 
methods. I reduced it to following example:

app.d(16): Error: this for Left needs to be type TBounds not type 
app.A
Failed: ["dmd", "-v", "-o-", "app.d", "-I."]

class TBounds
{
	@property float Left() {return 0.0;}
}

class A
{
	static void test()
	{
		typeof(TBounds.Left) m;
		
	}
	
	void test2()
	{
		typeof(TBounds.Left) m;
	}
}

void main() {}

How can I fix this issue?

Kind regards
André


More information about the Digitalmars-d-learn mailing list