Skip to content

Commit

Permalink
Merge pull request #2191 from 9rnsr/fix10375
Browse files Browse the repository at this point in the history
[REG2.061] Issue 10375 - private template from imported module hijacks a template type parameter(!)
  • Loading branch information
WalterBright committed Jun 24, 2013
2 parents ed061d5 + c544a2c commit 791fa01
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
Expand Up @@ -2042,22 +2042,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
@@ -0,0 +1,6 @@
module imports.test10375a;

private template Pack(T...)
{
alias T tuple;
}
13 changes: 13 additions & 0 deletions test/compilable/test10375.d
@@ -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 791fa01

Please sign in to comment.