[Issue 12020] New: 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 14:48:35 PST 2014


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

           Summary: Instantiating a template struct with equivalent const
                    and enum arguments creates two types.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: mason.b.mcgill at gmail.com


--- Comment #0 from Mason McGill <mason.b.mcgill at gmail.com> 2014-01-28 14:48:33 PST ---
This took me quite a few hours to figure out, and I can't think of any reason
this would be desired behavior:

//===========================================================================//

import std.stdio;

struct S(int n) {}

void main()
{
    enum e = 1;
    const c = 1;
    writeln(is(S!e == S!e)); // true.
    writeln(is(S!c == S!c)); // true. all good so far...
    writeln(is(S!e == S!c)); // false. that seems buggy...
    writeln(is(S!e == S!(cast(int) c))); // true. now that just can't be right.
}

//===========================================================================//

Unless I'm missing something, the expected behavior is to create a single 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