Skip to content

Commit

Permalink
fix Issue 12077 - Instantiated type does not match to the specialized…
Browse files Browse the repository at this point in the history
… alias parameter
  • Loading branch information
9rnsr committed Feb 21, 2014
1 parent 422bf8d commit 60ae588
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/template.c
Original file line number Diff line number Diff line change
Expand Up @@ -4684,12 +4684,19 @@ MATCH TemplateAliasParameter::matchArg(Scope *sc, RootObject *oarg,
{
if (sa == sdummy)
goto Lnomatch;
if (sa != specAlias && isDsymbol(sa))
Dsymbol *sx = isDsymbol(sa);
if (sa != specAlias && sx)
{
TemplateInstance *ti = isDsymbol(sa)->isTemplateInstance();
Type *ta = isType(specAlias);
if (!ti || !ta)
if (!ta)
goto Lnomatch;

TemplateInstance *ti = sx->isTemplateInstance();
if (!ti && sx->parent)
ti = sx->parent->isTemplateInstance();
if (!ti)
goto Lnomatch;

Type *t = new TypeInstance(Loc(), ti);
MATCH m2 = deduceType(t, sc, ta, parameters, dedtypes);
if (m2 <= MATCHnomatch)
Expand Down
12 changes: 12 additions & 0 deletions test/runnable/template9.d
Original file line number Diff line number Diff line change
Expand Up @@ -3120,6 +3120,18 @@ void test11843()
static assert(!is(typeof(bar3) == typeof(bar4)));
}

/******************************************/
// 12077

struct S12077(A) {}

alias T12077(alias T : Base!Args, alias Base, Args...) = Base;
static assert(__traits(isSame, T12077!(S12077!int), S12077));

alias U12077(alias T : Base!Args, alias Base, Args...) = Base;
alias U12077( T : Base!Args, alias Base, Args...) = Base;
static assert(__traits(isSame, U12077!(S12077!int), S12077));

/******************************************/
// 12122

Expand Down

0 comments on commit 60ae588

Please sign in to comment.