Skip to content

Commit

Permalink
fix Issue 8094 - Static if matching using alias parameter in template…
Browse files Browse the repository at this point in the history
… fails
  • Loading branch information
9rnsr committed May 14, 2012
1 parent 8f28a6b commit f61519b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/template.c
Expand Up @@ -2874,7 +2874,11 @@ MATCH TypeInstance::deduceType(Scope *sc,
{ /* Didn't find it as a parameter identifier. Try looking
* it up and seeing if is an alias. See Bugzilla 1454
*/
Dsymbol *s = tempinst->tempdecl->scope->search(0, tp->tempinst->name, NULL);
TypeIdentifier *tid = new TypeIdentifier(0, tp->tempinst->name);
Type *t;
Expression *e;
Dsymbol *s;
tid->resolve(0, sc, &e, &t, &s);
if (s)
{
s = s->toAlias();
Expand Down
19 changes: 19 additions & 0 deletions test/runnable/template9.d
Expand Up @@ -1242,6 +1242,24 @@ void test7933()
auto b = foo7933(Boo7933!1(1));
}

/**********************************/
// 8094

struct Tuple8094(T...) {}

template getParameters8094(T, alias P)
{
static if (is(T t == P!U, U...))
alias U getParameters8094;
else
static assert(false);
}

void test8094()
{
alias getParameters8094!(Tuple8094!(int, string), Tuple8094) args;
}

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

int main()
Expand Down Expand Up @@ -1293,6 +1311,7 @@ int main()
test7769();
test7873();
test7933();
test8094();

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

0 comments on commit f61519b

Please sign in to comment.