digitalmars.D.bugs - [Issue 1713] New: foreach index with tuples and templates fails
- d-bugmail puremagic.com (39/39) Dec 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1713
- d-bugmail puremagic.com (9/9) Feb 16 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1713
http://d.puremagic.com/issues/show_bug.cgi?id=1713 Summary: foreach index with tuples and templates fails Product: D Version: 2.008 Platform: PC OS/Version: Linux Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: dhasenan gmail.com --- import std.stdio; import std.traits; import std.metastrings; void main () { pragma(msg, Multi!(Object, "toString")()); } string Multi (T, string name) () { foreach (i, method; __traits(getVirtualFunctions, T, name)) { alias typeof(method) func; // SingleMethod fails.... Single!(i)(); // but Foo succeeds Foo!(ParameterTypeTuple!(func))(); } return ``; } string Single (int idx)() { return ``; } string Foo (U...) () { return ``; } --- The error message given is: Error: cannot evaluate Single() at compile time Obviously the index is a compile-time constant, or I couldn't use it as a template parameter. And the function without the template works, and giving a literal constant works. So I don't know what's going on. --
Dec 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1713 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from bugzilla digitalmars.com 2008-02-16 06:02 ------- Fixed dmd 2.010 --
Feb 16 2008