[Issue 21780] alias this preferred over immutable conversion even if alias this is deprecated and de is on

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 29 14:20:09 UTC 2021


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

--- Comment #6 from moonlightsentinel at disroot.org ---
Even worse when removing the immutable from S and using const parameters:

extern(C) void puts(const scope char*);

struct S { }

struct Nullable {
    S get_() { return S.init; }
    deprecated alias get_ this;
}

void foo(const Nullable) { puts("Nullable"); }
void foo(const S) { puts("S"); }

void main() {
    foo(Nullable()); // fails due to ambiguity
}

--


More information about the Digitalmars-d-bugs mailing list