www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8044] New: Print names, not casted values when using enum template parameter

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



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: -------
May 04 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8044


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



See also Issue 5004

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