Skip to content

Commit

Permalink
fix Issue 11774 - Lambda argument to templated function changes its s…
Browse files Browse the repository at this point in the history
…ignature forever
  • Loading branch information
9rnsr committed May 26, 2014
1 parent d060bdb commit 9c52a1e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/template.c
Expand Up @@ -4529,7 +4529,7 @@ MATCH deduceType(RootObject *o, Scope *sc, Type *tparam, TemplateParameters *par
Parameter *pto = Parameter::getNth(tof->parameters, u);
if (!pto)
break;
Type *t = pto->type;
Type *t = pto->type->syntaxCopy(); // Bugzilla 11774
if (reliesOnTident(t, parameters, inferStart))
return;
t = t->semantic(e->loc, sc);
Expand Down
18 changes: 18 additions & 0 deletions test/runnable/funclit.d
Expand Up @@ -980,6 +980,23 @@ void test11661()
void function() fp = {}; // OK <- NG
}

/***************************************************/
// 11774

void f11774(T, R)(R delegate(T[]) dg)
{
T[] src;
dg(src);
}

void test11774()
{
int[] delegate(int[]) dg = (int[] a) => a;
f11774!int(dg);
f11774!Object(a => a);
f11774!int(dg);
}

/***************************************************/
// 12508

Expand Down Expand Up @@ -1067,6 +1084,7 @@ int main()
test10288();
test10336();
test11661();
test11774();
test12508();

printf("Success\n");
Expand Down

0 comments on commit 9c52a1e

Please sign in to comment.