Skip to content

Commit

Permalink
merge D2 pull #867
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Apr 15, 2012
1 parent 6dcaf73 commit aa8f7ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/dsymbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,7 @@ Dsymbol *ArrayScopeSymbol::search(Loc loc, Identifier *ident, int flags)
VoidInitializer *e = new VoidInitializer(0);
e->type = Type::tsize_t;
v->init = e;
v->storage_class |= STCctfe; // it's never a true static variable
}
*pvar = v;
}
Expand Down
13 changes: 6 additions & 7 deletions src/template.c
Original file line number Diff line number Diff line change
Expand Up @@ -1449,13 +1449,13 @@ FuncDeclaration *TemplateDeclaration::deduceFunctionTemplate(Scope *sc, Loc loc,
printf(" targsi:\n");
if (targsi)
{ for (size_t i = 0; i < targsi->dim; i++)
{ Object *arg = (Object *)targsi->data[i];
{ Object *arg = (*targsi)[i];
printf("\t%s\n", arg->toChars());
}
}
printf(" fargs:\n");
for (size_t i = 0; i < fargs->dim; i++)
{ Expression *arg = fargs->tdata()[i];
{ Expression *arg = (*fargs)[i];
printf("\t%s %s\n", arg->type->toChars(), arg->toChars());
//printf("\tty = %d\n", arg->type->ty);
}
Expand All @@ -1475,10 +1475,9 @@ FuncDeclaration *TemplateDeclaration::deduceFunctionTemplate(Scope *sc, Loc loc,
goto Lerror;
}

MATCH m;
Objects dedargs;

m = td->deduceFunctionTemplateMatch(loc, targsi, ethis, fargs, &dedargs);
MATCH m = td->deduceFunctionTemplateMatch(loc, targsi, ethis, fargs, &dedargs);
//printf("deduceFunctionTemplateMatch = %d\n", m);
if (!m) // if no match
continue;
Expand Down Expand Up @@ -1516,7 +1515,7 @@ FuncDeclaration *TemplateDeclaration::deduceFunctionTemplate(Scope *sc, Loc loc,
td_best = td;
m_best = m;
tdargs->setDim(dedargs.dim);
memcpy(tdargs->data, dedargs.data, tdargs->dim * sizeof(void *));
memcpy(tdargs->tdata(), dedargs.tdata(), tdargs->dim * sizeof(void *));
continue;
}
if (!td_best)
Expand Down Expand Up @@ -1567,15 +1566,15 @@ FuncDeclaration *TemplateDeclaration::deduceFunctionTemplate(Scope *sc, Loc loc,
{
if (i)
bufa.writeByte(',');
Object *oarg = args->tdata()[i];
Object *oarg = (*args)[i];
ObjectToCBuffer(&bufa, &hgs, oarg);
}
}

OutBuffer buf;
argExpTypesToCBuffer(&buf, fargs, &hgs);
if (this->overnext)
::error(loc, "%s %s.%s cannot deduce template function from argument types !(%s)(%s)",
::error(this->loc, "%s %s.%s cannot deduce template function from argument types !(%s)(%s)",
kind(), parent->toPrettyChars(), ident->toChars(),
bufa.toChars(), buf.toChars());
else
Expand Down

0 comments on commit aa8f7ca

Please sign in to comment.