digitalmars.D.bugs - [Issue 8701] New: One case of template type deduction
- d-bugmail puremagic.com (29/29) Sep 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8701
- d-bugmail puremagic.com (22/31) Sep 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8701
http://d.puremagic.com/issues/show_bug.cgi?id=8701 Summary: One case of template type deduction Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc --- Comment #0 from bearophile_hugs eml.cc 2012-09-20 10:17:13 PDT --- Is this supposed to work? If the answer is negative, maybe it's a good idea to support this: struct Foo(T) {} void bar(Spam, T)(Spam!T y) {} void main() { Foo!int x; bar(x); } DMD 2.061alpha gives: temp.d(5): Error: template temp.bar does not match any function template declaration temp.d(5): Error: template temp.bar(Spam,T) cannot deduce template function from argument types !()(Foo!(int)) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 20 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8701 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2012-09-20 18:18:33 PDT --- (In reply to comment #0)Is this supposed to work? If the answer is negative, maybe it's a good idea to support this: struct Foo(T) {} void bar(Spam, T)(Spam!T y) {} void main() { Foo!int x; bar(x); }Compiler would infer Spam as a template symbol in IFTI, but it is TemplateTypeParameter. Therefore this doesn't work. Correct code is here: struct Foo(T) {} void bar(alias Spam, T)(Spam!T y) {} void main() { Foo!int x; bar(x); } You can receive deduced template symbol by TemplateAliasParamerter. Then all works. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 20 2012