digitalmars.D.bugs - [Issue 6082] New: Constructors of templated types should be callable vi IFTI
- d-bugmail puremagic.com (40/40) May 31 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6082
- d-bugmail puremagic.com (6/6) May 13 2013 http://d.puremagic.com/issues/show_bug.cgi?id=6082
http://d.puremagic.com/issues/show_bug.cgi?id=6082 Summary: Constructors of templated types should be callable vi IFTI Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: schveiguy yahoo.com --- Comment #0 from Steven Schveighoffer <schveiguy yahoo.com> 2011-05-31 12:36:46 PDT --- If I have the following class: class A(T) { this(T t) {} } I must specify the class type in order to call its constructor: auto a = new A(1); // error auto b = new A!int(1); // ok But IFTI works in this instance: template foo(T) { void foo(T t) {} } I see little difference between the first and second cases -- both must be partially instantiated by the compiler to determine if there is a valid function to call. Further supporting this, I can add a factory function: A(T) createA(T)(T t) { return new A!T(t); } which now is callable via IFTI: auto a = createA(1); // ok. It seems like the necessary logic is present in the compiler, it just needs to be utilized during a constructor call. The same should apply to structs. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 31 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6082 --- Comment #1 from Steven Schveighoffer <schveiguy yahoo.com> 2013-05-13 15:54:21 PDT --- Also see DIP 40: http://wiki.dlang.org/DIP40 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 13 2013