[Issue 1391] New: Implicit Instantiation: deducing 'int n' from the number of arguments
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 31 11:42:46 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1391
Summary: Implicit Instantiation: deducing 'int n' from the number
of arguments
Product: D
Version: 1.020
Platform: PC
OS/Version: Linux
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: webmaster at villagersonline.com
My 2nd of 2 implicit instantiation bugs. This one came about when I was trying
to do implicit instantiation of a Curry template, where the user can pass more
than one argument. The template wants to deduce the delegate arguments *and*
the number of elements to curry.
Note, in the code below, that DMD can deduce the contents of Tuple U from the
arguments inside the delegate which is passed as the first argument, and can
deduce the value of n by figuring out how many arguments were passed after
that. I'm not saying it would be easy to code, just that it is possible for
DMD to deduce this from the available information, and if it had, then my code
would have worked. :)
CODE
============
void delegate(U[n..$]) Curry(int n,U...)(void delegate(U) dg,U[0..n] args)
{
return null;
}
struct Foo {
void f1(uint i) {}
}
void f2()
{
auto temp = new Foo;
auto dg1 = Curry!(1,uint)(&temp.f1, cast(uint)0);
auto dg2 = Curry (&temp.f1, cast(uint)0);
}
DMD OUTPUT
===============
implicit_instantiation2.d(14): template implicit_instantiation2.Curry(int
n,U...) does not match any template declaration
implicit_instantiation2.d(14): template implicit_instantiation2.Curry(int
n,U...) cannot deduce template function from argument types (void
delegate((uint _param_1)),uint)
--
More information about the Digitalmars-d-bugs
mailing list