Skip to content

Commit

Permalink
fix Issue 14481 - ICE with forward reference of manifest constant on …
Browse files Browse the repository at this point in the history
…template arguments
  • Loading branch information
9rnsr committed Apr 23, 2015
1 parent 199be8b commit 30fad36
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/template.c
Expand Up @@ -6652,6 +6652,13 @@ bool TemplateInstance::semanticTiargs(Loc loc, Scope *sc, Objects *tiargs, int f
}
else if (ea->op == TOKvar)
{
VarDeclaration *v = ((VarExp *)ea)->var->isVarDeclaration();
if (v && !(v->storage_class & STCtemplateparameter))
{
if (v->sem < SemanticDone && v->scope)
v->semantic(NULL);
}

/* This test is to skip substituting a const var with
* its initializer. The problem is the initializer won't
* match with an 'alias' parameter. Instead, do the
Expand Down
19 changes: 19 additions & 0 deletions test/runnable/template9.d
Expand Up @@ -4497,6 +4497,25 @@ template Qux14357(T : U*, U : V*, V)
}
static assert(!__traits(compiles, Qux14357!(float**, int*)));

/******************************************/
// 14481

template someT14481(alias e)
{
alias someT14481 = e;
}

mixin template Mix14481(alias e)
{
alias SomeAlias = someT14481!e;
}

struct Hoge14481
{
mixin Mix14481!e;
enum e = 10;
}

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

int main()
Expand Down

0 comments on commit 30fad36

Please sign in to comment.