digitalmars.D.bugs - [Issue 10083] New: Insufficient IFTI/eponymous template specification
- d-bugmail puremagic.com (56/56) May 14 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10083
- d-bugmail puremagic.com (10/10) May 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10083
- d-bugmail puremagic.com (11/11) Jun 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10083
- d-bugmail puremagic.com (10/10) Jun 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10083
http://d.puremagic.com/issues/show_bug.cgi?id=10083 Summary: Insufficient IFTI/eponymous template specification Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: timon.gehr gmx.ch The spec does not say how IFTI and the eponymous template trick behave when the eponymous declaration is overloaded. DMD's strategy is roughly: use the first eponymous declaration that can be found without analysing the template body for IFTI, then use the first eponymous declaration in the analyzed template body to resolve the eponymous declaration after instantiation. --- import std.stdio; template fun(T){ int fun(double arg){ return 1; } int fun(T arg){ return 0; } } void main(){ writeln(fun(2)); } // error --- import std.stdio; template fun(T){ int fun(T arg){ return 0; } int fun(double arg){ return 1; } } void main(){ writeln(fun(2)); } // ok --- This has funny implications, as the compiler may decide to resolve to a different declaration than was used for IFTI later, without doing any kind of overload resolution within the template body. --- template fun(T){ int fun(T arg){ return 0; } static if(true) int fun(double arg){ return 1; } } pragma(msg, fun(2)); // 0 --- template fun(T){ static if(true) int fun(double arg){ return 1; } int fun(T arg){ return 0; } } pragma(msg, fun(2)); // 1 --- In the second case, instantiation is performed with the second function, so T is resolved to 'int', but in the end, the 'double' overload is called with an implicit conversion. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 14 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10083 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull https://github.com/D-Programming-Language/dmd/pull/2041 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10083 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/10cf2d97cd8fffce312d8bf48ca4830ceb5bed05 fix Issue 10083 - Insufficient IFTI/eponymous template specification https://github.com/D-Programming-Language/dmd/commit/ed83e21e69bce7dc4b7ef223c6e0cfb59013bf82 Issue 10083 - Insufficient IFTI/eponymous template specification -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 26 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10083 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 26 2013