Stewart Gordon escribió:
Jarrett Billingsley wrote:
On Fri, Jun 26, 2009 at 5:54 PM, Ary Borenszweig<[email protected]>
wrote:
Is is ok that this compiles without errors?
class Foo {
alias errorProne this;
}
Errors as expected on 1.042; compiles on 2.029.
If I had to guess, it's only OK because the compiler probably doesn't
actually look for the aliased symbol until you actually try to access
something from it. But that does seem .. wrong.
It is wrong. Since this isn't in a template, the compiler should
perform semantic analysis on it in any case, and thus report an error.
But the really strange thing is that it doesn't complain about the
attempt to redefine 'this', which is a keyword.
It's called "alias this", that's not the problem:
http://digitalmars.com/d/2.0/class.html#AliasThis
I also think it should complain, because it makes no sense to just leave
it there, unresolved.