[Issue 12020] Instantiating a template struct with equivalent const and enum arguments creates two types.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 28 15:34:44 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12020



--- Comment #2 from Mason McGill <mason.b.mcgill at gmail.com> 2014-01-28 15:34:42 PST ---
(In reply to comment #1)
> typeof(e) == int - an underlying type of an enum.
> typeof(c) == const(int).
> 
> Hence two distinct types.

Right--so that should yield two distinct template instances if you were
parameterizing by type, like this:

    struct S1(T) {}

but my example involved parameterizing by value, like this:

    struct S1(int n) {}

Since the value of `cast(int)(e)` and `cast(int)(c)` are the same, shouldn't
the two types be the same?  Also,

writeln(S1!e()); // prints the same output as
writeln(S1!c()); // which is pretty confusing if they're not the same type.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list