[Issue 9024] New: Inferring function argument types from other template parameters
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 14 05:43:26 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9024
Summary: Inferring function argument types from other template
parameters
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: joseph.wakeling at webdrake.net
--- Comment #0 from Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> 2012-11-14 05:43:25 PST ---
The attached code most likely ought to be valid according to the spec at
http://dlang.org/template.html (point 2 under "Argument Deduction" states: "If
the type specialization is dependent on a type parameter, the type of that
parameter is set to be the corresponding part of the type argument"):
struct Foo(_T)
{
alias _T T;
}
void func(T)(T foo, T.T x)
{
}
void main()
{
Foo!int foo;
func(foo, 3);
}
However, it fails to compile with an error
infer.d(13): Error: undefined identifier T.T
infer.d(13): Error: template infer.func does not match any function template
declaration
infer.d(13): Error: template infer.func(T) cannot deduce template function from
argument types !()(Foo!(int),int)
See discussion thread here:
http://forum.dlang.org/post/mailman.1810.1352724147.5162.digitalmars-d-learn@puremagic.com
http://forum.dlang.org/post/mailman.1812.1352726032.5162.digitalmars-d-learn@puremagic.com
http://forum.dlang.org/post/k7u134$1t35$1@digitalmars.com
... and also the following bug report where the issue is discussed:
http://d.puremagic.com/issues/show_bug.cgi?id=9004
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list