Skip to content

Commit

Permalink
fix Issue 11944 - ICE(expression.c) Assertion `f' failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Jan 20, 2014
1 parent 2401bf3 commit 5d1237d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/expression.c
Original file line number Diff line number Diff line change
Expand Up @@ -9307,7 +9307,7 @@ Expression *AddrExp::semantic(Scope *sc)
{
//assert(ti->needsTypeInference(sc));
ti->semantic(sc);
if (!ti->inst) // if template failed to expand
if (!ti->inst || ti->errors) // if template failed to expand
return new ErrorExp;
Dsymbol *s = ti->inst->toAlias();
FuncDeclaration *f = s->isFuncDeclaration();
Expand All @@ -9323,7 +9323,7 @@ Expression *AddrExp::semantic(Scope *sc)
{
//assert(ti->needsTypeInference(sc));
ti->semantic(sc);
if (!ti->inst) // if template failed to expand
if (!ti->inst || ti->errors) // if template failed to expand
return new ErrorExp;
Dsymbol *s = ti->inst->toAlias();
FuncDeclaration *f = s->isFuncDeclaration();
Expand Down
12 changes: 12 additions & 0 deletions test/fail_compilation/ice11944.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice11944.d(12): Error: template instance doCommand!(func) does not match template declaration doCommand(f, T)(f, T arg)
---
*/

void func(int var) {}

void doCommand(f, T)(f, T arg) {}

auto var = &doCommand!func;

0 comments on commit 5d1237d

Please sign in to comment.