[Issue 18260] ICE on template this parameter and alias this

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 19 08:04:35 UTC 2018


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

--- Comment #3 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Slightly different version where the given workarounds don't work:

struct R(T) {
    // Used 'auto' here, but 'This' or 'R!(const int)' gives same behavior.
    // Marking the method const or immutable likewise has no effect.
    auto get(this This)() {
        return R!(const int).init;
    }
    alias get this;
}
unittest {
    R!int a;
    R!(const int) b = a;
}

Note that the array is no longer needed.
Interestingly, adding pragma(msg, This) inside get() provides no output.

--


More information about the Digitalmars-d-bugs mailing list