[Issue 19167] Overzealous "Using this as a type is deprecated"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 14 11:26:58 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19167

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ag0aep6g at gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from ag0aep6g <ag0aep6g at gmail.com> ---
In the first case, there is no `this` object, so DMD interprets it to mean the
type of `this`. That's been deprecated.

In the second case, there is an `a` object. The alias is still the same as
`typeof(a).a`, but that's ok. Making the alias has not been deprecated. The
deprecation is about using `this` where there is no object `this`.

Similarly, you can still use `alias b = this.a;` inside a method:

----
struct A
{
    alias a = int;
    void m()
    {
        alias b = this.a; /* no deprecation */
    }
}
----

I'm closing this as invalid. As usual, feel free to reopen if I missed
something.

--


More information about the Digitalmars-d-bugs mailing list