Skip to content

Commit

Permalink
Merge branch '2.063' of github.com:D-Programming-Language/dmd into 2.063
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jun 11, 2013
2 parents b0240e5 + 9069185 commit 37922a6
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 23 deletions.
51 changes: 28 additions & 23 deletions src/expression.c
Expand Up @@ -8337,6 +8337,8 @@ Expression *CallExp::semantic(Scope *sc)
{
e1 = new DotVarExp(loc, dte->e1, f);
e1 = e1->semantic(sc);
if (e1->op == TOKerror)
return new ErrorExp();
ue = (UnaExp *)e1;
}
#if 0
Expand Down Expand Up @@ -8797,31 +8799,34 @@ Expression *AddrExp::semantic(Scope *sc)
{
DotTemplateInstanceExp* dti = (DotTemplateInstanceExp *)e1;
TemplateInstance *ti = dti->ti;
assert(!ti->semanticRun);
//assert(ti->needsTypeInference(sc));
ti->semantic(sc);
if (!ti->inst) // if template failed to expand
return new ErrorExp;
Dsymbol *s = ti->inst->toAlias();
FuncDeclaration *f = s->isFuncDeclaration();
assert(f);
e1 = new DotVarExp(e1->loc, dti->e1, f);
e1 = e1->semantic(sc);
if (!ti->semanticRun)
{
//assert(ti->needsTypeInference(sc));
ti->semantic(sc);
if (!ti->inst) // if template failed to expand
return new ErrorExp;
Dsymbol *s = ti->inst->toAlias();
FuncDeclaration *f = s->isFuncDeclaration();
assert(f);
e1 = new DotVarExp(e1->loc, dti->e1, f);
e1 = e1->semantic(sc);
}
}
else if (e1->op == TOKimport &&
((ScopeExp *)e1)->sds->isTemplateInstance())
else if (e1->op == TOKimport)
{
TemplateInstance *ti = (TemplateInstance *)((ScopeExp *)e1)->sds;
assert(!ti->semanticRun);
//assert(ti->needsTypeInference(sc));
ti->semantic(sc);
if (!ti->inst) // if template failed to expand
return new ErrorExp;
Dsymbol *s = ti->inst->toAlias();
FuncDeclaration *f = s->isFuncDeclaration();
assert(f);
e1 = new VarExp(e1->loc, f);
e1 = e1->semantic(sc);
TemplateInstance *ti = ((ScopeExp *)e1)->sds->isTemplateInstance();
if (ti && !ti->semanticRun)
{
//assert(ti->needsTypeInference(sc));
ti->semantic(sc);
if (!ti->inst) // if template failed to expand
return new ErrorExp;
Dsymbol *s = ti->inst->toAlias();
FuncDeclaration *f = s->isFuncDeclaration();
assert(f);
e1 = new VarExp(e1->loc, f);
e1 = e1->semantic(sc);
}
}
e1 = e1->toLvalue(sc, NULL);
if (e1->op == TOKerror)
Expand Down
11 changes: 11 additions & 0 deletions test/fail_compilation/fail10299.d
@@ -0,0 +1,11 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail10299.d(11): Error: foo!(string) is not an lvalue
---
*/

template foo(T)
{
}
auto fp = &foo!string; // ICE

0 comments on commit 37922a6

Please sign in to comment.