Skip to content

Commit

Permalink
fix Issue 10375 - private template from imported module hijacks a tem…
Browse files Browse the repository at this point in the history
…plate type parameter(!)
  • Loading branch information
9rnsr committed Jun 20, 2013
1 parent 97abb8a commit c544a2c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/template.c
Original file line number Diff line number Diff line change
Expand Up @@ -2001,22 +2001,6 @@ RootObject *TemplateDeclaration::declareParameter(Scope *sc, TemplateParameter *
Dsymbol *s;
VarDeclaration *v = NULL;

// See if tp->ident already exists with a matching definition
Dsymbol *scopesym;
s = sc->search(loc, tp->ident, &scopesym);
if (s && scopesym == sc->scopesym)
{
TupleDeclaration *td = s->isTupleDeclaration();
if (va && td)
{ Tuple tup;
tup.objects = *td->objects;
checkRecursiveExpansion(va, this, sc);
if (match(va, &tup))
{
return o;
}
}
}
if (ea && ea->op == TOKtype)
targ = ea->type;
else if (ea && ea->op == TOKimport)
Expand Down
6 changes: 6 additions & 0 deletions test/compilable/imports/test10375a.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module imports.test10375a;

private template Pack(T...)
{
alias T tuple;
}
13 changes: 13 additions & 0 deletions test/compilable/test10375.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// REQUIRED_ARGS: -o-

import imports.test10375a;

void packIt(Pack)(Pack p){ } //3

void main()
{
alias p = packIt!(int);
p(2); // OK <- NG
packIt(2); // OK <- NG
packIt!(int)(2); // OK <- NG
}

0 comments on commit c544a2c

Please sign in to comment.