[Issue 20863] Passing aggregate types into templates by alias drops qualifier

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 26 07:51:18 UTC 2020


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

--- Comment #6 from uplink.coder at googlemail.com ---
struct Foo {}

template P(alias X)
{
    pragma(msg, X);
    enum P = 1;
}

int y = P!(const int);
int x = P!(immutable(double));
int z = P!(immutable(Foo));
int z2 = P!(immutable Foo);

The output of this is
const(int)
immutable(double)
Foo

What happens is that the types which are not symbols are merely "losslessly
cast" to a symbol.
Therefore the STC is not dropped.

That means the new addition of types matching to alias behaves inconsistently.
Not the other way around.

--


More information about the Digitalmars-d-bugs mailing list