Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 5988 - Template accepts instantiating an already-instantiated template type #2051

Merged
merged 1 commit into from Jun 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/template.c
Expand Up @@ -5915,8 +5915,8 @@ bool TemplateInstance::findTemplateDeclaration(Scope *sc)
//assert(s->parent);
TemplateInstance *ti = s->parent ? s->parent->isTemplateInstance() : NULL;
if (ti &&
(ti->name == id ||
ti->toAlias()->ident == id)
(ti->name == s->ident ||
ti->toAlias()->ident == s->ident)
&&
ti->tempdecl)
{
Expand Down
16 changes: 16 additions & 0 deletions test/runnable/template9.d
Expand Up @@ -265,6 +265,22 @@ void test5893()
assert((c += 1) == 3); // overload
}

/**********************************/
// 5988

template Templ5988(alias T)
{
alias T!int Templ5988;
}

class C5988a(T) { Templ5988!C5988a foo; }
//Templ5988!C5988a foo5988a; // Commented version
void test5988a() { C5988a!int a; } // Was error, now works

class C5988b(T) { Templ5988!C5988b foo; }
Templ5988!C5988b foo5988b; // Uncomment version
void test5988b() { C5988b!int a; } // Works

/**********************************/
// 6404

Expand Down