Skip to content

Commit

Permalink
fix Issue 11242 - Fails to infer template argument with inout
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Oct 14, 2013
1 parent fc9b88c commit 81e6841
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/template.c
Original file line number Diff line number Diff line change
Expand Up @@ -3362,7 +3362,7 @@ MATCH Type::deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters,

if (nextOf())
{
if (tparam->deco)
if (tparam->deco && !tparam->hasWild())
return implicitConvTo(tparam);

return nextOf()->deduceType(sc, tparam->nextOf(), parameters, dedtypes, wildmatch);
Expand Down
15 changes: 15 additions & 0 deletions test/runnable/template9.d
Original file line number Diff line number Diff line change
Expand Up @@ -2804,6 +2804,20 @@ void test10592()
assert(x.put("abcde"d) == 2); // OK: hit 2
}

/******************************************/
// 11242

inout(T[]) fromString11242(T)(inout(char[]) s, T[] dst)
{
return s;
}

void test11242()
{
char[] a;
fromString11242(a, a);
}

/******************************************/
// 10811

Expand Down Expand Up @@ -2925,6 +2939,7 @@ int main()
test9977();
test10083();
test10592();
test11242();
test10811();
test10969();

Expand Down

0 comments on commit 81e6841

Please sign in to comment.