Skip to content

Commit

Permalink
fix Issue 13374 - Wrong template overload resolution when passing fun…
Browse files Browse the repository at this point in the history
…ction to alias/string parameter
  • Loading branch information
9rnsr committed Aug 25, 2014
1 parent 4d4938c commit 586686e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/template.c
Expand Up @@ -5265,7 +5265,7 @@ MATCH TemplateValueParameter::matchArg(Scope *sc, RootObject *oarg,
ei = new VarExp(loc, f);
ei = ei->semantic(sc);
if (!f->needThis())
ei = resolveProperties(sc, ei);
ei = resolvePropertiesOnly(sc, ei);
/* If it was really a property, it will become a CallExp.
* If it stayed as a var, it cannot be interpreted.
*/
Expand Down
14 changes: 14 additions & 0 deletions test/runnable/template9.d
Expand Up @@ -4038,6 +4038,19 @@ void test13333()
}
}

/******************************************/
// 13374

int f13374(alias a)() { return 1; }
int f13374(string s)() { return 2; }

void x13374(int i) {}

void test13374()
{
assert(f13374!x13374() == 1);
}

/******************************************/

int main()
Expand Down Expand Up @@ -4141,6 +4154,7 @@ int main()
test12376();
test13235();
test13299();
test13374();

printf("Success\n");
return 0;
Expand Down

0 comments on commit 586686e

Please sign in to comment.