import std.stdio;
class Foo
{
this() { o = new Object(); }
Object o;
alias o this;
override string toString()
{
return "Foo";
}
}
void foo(Object o)
{
writeln(o);
}
void main()
{
foo(new Foo());
}
The code compiles, and prints "Foo". After discussing with Andrei, I believe this code is an error.
Comment #1 by andrei — 2011-04-17T06:56:37Z
Yah, it's a simple case of unreachable code - the alias this would never ever get a chance. This needs to be rejected.