Skip to content

Commit

Permalink
Merge pull request #3549 from 9rnsr/fix12746
Browse files Browse the repository at this point in the history
Issue 12746 - Wrong overload access within manually aliased eponymous function template
  • Loading branch information
WalterBright committed May 14, 2014
2 parents 50001bc + 3c45ff1 commit f7babe2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/expression.c
Expand Up @@ -1186,17 +1186,11 @@ TemplateDeclaration *getFuncTemplateDecl(Dsymbol *s)
if (f && f->parent)
{
TemplateInstance *ti = f->parent->isTemplateInstance();
TemplateDeclaration *td;
if (ti &&
!ti->isTemplateMixin() &&
(ti->name == f->ident ||
ti->toAlias()->ident == f->ident)
&&
ti->tempdecl &&
(td = ti->tempdecl->isTemplateDeclaration()) != NULL &&
td->onemember)
{
return td;
if (ti && !ti->isTemplateMixin() &&
ti->tempdecl && ((TemplateDeclaration *)ti->tempdecl)->onemember &&
ti->tempdecl->ident == f->ident)
{
return (TemplateDeclaration *)ti->tempdecl;
}
}
return NULL;
Expand Down
22 changes: 22 additions & 0 deletions test/runnable/template9.d
Expand Up @@ -3411,6 +3411,28 @@ struct W12719(R)

W12719!int a12719;

/******************************************/
// 12746

template foo12746()
{
void bar()
{
static assert(!__traits(compiles, bar(1)));
}
alias foo12746 = bar;
}

void foo12746(int)
{
assert(0);
}

void test12746()
{
foo12746(); // instantiate
}

/******************************************/

int main()
Expand Down

0 comments on commit f7babe2

Please sign in to comment.