May 05, 2012 [Issue 8044] New: Print names, not casted values when using enum template parameter | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@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: ------- |
May 06, 2012 [Issue 8044] Print names, not casted values when using enum template parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=8044 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2012-05-06 06:50:44 PDT --- See also Issue 5004 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation