[Issue 2626] New: template function not working against template struct instantiated with default arguments
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 27 15:01:00 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2626
Summary: template function not working against template struct
instantiated with default arguments
Product: D
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: andrei at metalanguage.com
The following code doesn't compile:
struct S(T, int x = 1){}
S!(T, x) fun(T, int x)(T a, S!(T, x) b) {return b;}
void main()
{
S!(int) s;
s = fun(2, s);
}
Error message:
./test.d(nn): template test.fun(T,int x) does not match any function template
declaration
./test.d(nn): template test.fun(T,int x) cannot deduce template function from
argument types !()(int,S!(int))
./test.d(nn): Error: cannot implicitly convert expression ((fun(T,int
x))(2,s))of type int to S!(int)
Changing the definition of s to:
S!(int, 4) s;
makes the code work, so I presume it's a simple bug.
--
More information about the Digitalmars-d-bugs
mailing list