Skip to content

Commit

Permalink
Cleanup TemplateTypeParameter::matchArg()
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Dec 26, 2011
1 parent 9d2ffd8 commit 5a8182b
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/template.c
Expand Up @@ -3099,7 +3099,6 @@ MATCH TemplateTypeParameter::matchArg(Scope *sc, Objects *tiargs,
Declaration **psparam)
{
//printf("TemplateTypeParameter::matchArg()\n");
Type *t;
Object *oarg;
MATCH m = MATCHexact;
Type *ta;
Expand Down Expand Up @@ -3128,8 +3127,6 @@ MATCH TemplateTypeParameter::matchArg(Scope *sc, Objects *tiargs,
}
//printf("ta is %s\n", ta->toChars());

t = (Type *)dedtypes->tdata()[i];

if (specType)
{
if (!ta || ta == tdummy)
Expand All @@ -3144,30 +3141,29 @@ MATCH TemplateTypeParameter::matchArg(Scope *sc, Objects *tiargs,

if (m2 < m)
m = m2;
t = (Type *)dedtypes->tdata()[i];
if (dedtypes->tdata()[i])
ta = (Type *)dedtypes->tdata()[i];
}
else
{
// So that matches with specializations are better
m = MATCHconvert;

if (t)
if (dedtypes->tdata()[i])
{ // Must match already deduced type
Type *t = (Type *)dedtypes->tdata()[i];

m = MATCHexact;
if (!t->equals(ta))
{ //printf("t = %s ta = %s\n", t->toChars(), ta->toChars());
goto Lnomatch;
}
}
else
{
// So that matches with specializations are better
m = MATCHconvert;
}
}
dedtypes->tdata()[i] = ta;

if (!t)
{
dedtypes->tdata()[i] = ta;
t = ta;
}
*psparam = new AliasDeclaration(loc, ident, t);
*psparam = new AliasDeclaration(loc, ident, ta);
//printf("\tm = %d\n", m);
return m;

Expand Down

0 comments on commit 5a8182b

Please sign in to comment.