http://d.puremagic.com/issues/show_bug.cgi?id=8044

           Summary: Print names, not casted values when using enum
                    template parameter
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2012-05-04 
20:33:56 PDT ---
enum Enum { Foo, Bar }
void test(Enum en)()
    if(0)
{ 
}

void main()
{
    test!(Enum.Bar)();
}

test.d(11): Error: template instance test!(cast(Enum)1) test!(cast(Enum)1) does
not match template declaration test(Enum en) if (0)
test.d(11): Error: function expected before (), not test!(cast(Enum)1) of type
void

This is really awful because when you have over a few dozen fields in an enum
you end up having to count the fields to figure out which enum value was
actually used when instantiating the template. (Either that or having to insert
a to!string call just for debugging).

The above errors should be:

test.d(11): Error: template instance test!(Enum.Bar) test!(Enum.Bar) does not
match template declaration test(Enum en) if (0)
test.d(11): Error: function expected before (), not test!(Enum.Bar) of type
void

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

Reply via email to