[Issue 8044] New: Print names, not casted values when using enum template parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 4 20:32:44 PDT 2012
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 at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at 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: -------
More information about the Digitalmars-d-bugs
mailing list