digitalmars.D.bugs - [Issue 2616] New: Undocumented behaviour: part-explicit, part-implicit instantiations of function templates are accepted
- d-bugmail puremagic.com (48/48) Jan 25 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2616
- d-bugmail puremagic.com (7/7) Jan 25 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2616
- d-bugmail puremagic.com (12/12) Nov 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2616
http://d.puremagic.com/issues/show_bug.cgi?id=2616 Summary: Undocumented behaviour: part-explicit, part-implicit instantiations of function templates are accepted Product: D Version: 1.039 Platform: PC URL: http://www.digitalmars.com/d/1.0/template.html OS/Version: Windows Status: NEW Keywords: accepts-invalid, spec Severity: normal Priority: P2 Component: www.digitalmars.com AssignedTo: bugzilla digitalmars.com ReportedBy: smjg iname.com OtherBugsDependingO 2599 nThis: `Function templates can be explicitly instantiated with a !(TemplateArgumentList): writefln("The square of %s is %s", 3, Square!(int)(3)); or implicitly, where the TemplateArgumentList is deduced from the types of the function arguments: writefln("The square of %s is %s", 3, Square(3)); // T is deduced to be int` It's just come to my attention that the compiler allows an in-between case that isn't covered by the current documentation, either for D1 or for D2. ---------- import std.stdio; void fun(T1, T2)(T2 x) { pragma(msg, T1.stringof); writefln(x); } void main() { fun!(int)("hello!"); } ---------- C:\Users\Stewart\Documents\Programming\D\Tests>dmd template_partial.d int C:\Users\Stewart\Documents\Programming\D\Tests>template_partial hello! ---------- What is T2? The template instantiation is explicit in form, but doesn't match the parameter list with which the template is declared. Neither is T2 deduced from the given template arguments. Neither is it IFTI as currently documented, since a template parameter list has been given. Rather, the template instantiation is of an undocumented mix of the two styles. Issue 2599 comment 6 implies that this feature is intended, but you forgot to document it. --
Jan 25 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2616 See this bug: http://d.puremagic.com/issues/show_bug.cgi?id=493 It was mentioned in the changelog of 1.038. It could certainly be documented better. --
Jan 25 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2616 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 16:39:15 PST --- http://www.dsource.org/projects/phobos/changeset/2146 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 09 2010