[Issue 19060] [REG2.081] Incorrect "Using this as a type is deprecated" error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 5 14:32:37 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19060
--- Comment #6 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to johanengelen from comment #5)
> OK, then this is still broken and should receive a deprecation message too:
>
> ```
> struct S {
> int a;
> bool x;
> public ref foo() {
> alias yoyo = this.x;
> return yoyo;
> }
> }
> ```
Actually, I don't think it should. Foo can only be called on an instance,
therefore `this` does make sense in that context. Imagine that you would define
a local variable x, if you wouldn't be able to use `this` then the local would
mask the member everywhere.
I suggest to close this as invalid.
--
More information about the Digitalmars-d-bugs
mailing list