Permalink
Browse files

Merge pull request #1678 from 9rnsr/fix9545

[REG 2.063a] Issue 9545 - ICE with member template instantiation
  • Loading branch information...
2 parents 0b575f9 + 3cb0aee commit 4b83c91f91208fb63a5ce63b707c65766055d357 @WalterBright WalterBright committed Feb 20, 2013
Showing with 16 additions and 2 deletions.
  1. +2 −2 src/expression.c
  2. +14 −0 test/fail_compilation/ice9545.d
View
@@ -7097,7 +7097,7 @@ Expression *DotVarExp::semantic(Scope *sc)
if (e)
return e;
- if (v->isDataseg()) // fix bugzilla 8238
+ if (v && v->isDataseg()) // fix bugzilla 8238
{
// (e1, v)
accessCheck(loc, sc, e1, v);
@@ -7321,7 +7321,7 @@ Expression *DotTemplateInstanceExp::semantic(Scope *sc, int flag)
return new ErrorExp();
Dsymbol *s = ti->inst->toAlias();
Declaration *v = s->isDeclaration();
- if (v)
+ if (v && (v->isFuncDeclaration() || v->isVarDeclaration()))
{
/* Fix for Bugzilla 4003
* The problem is a class template member function v returning a reference to the same
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+----
+fail_compilation/ice9545.d(13): Error: expression has no value
+----
+*/
+
+struct S { template T(X) { alias T = X; } }
+
+void main()
+{
+ auto x1 = S.init.T!int; // ICE
+}

0 comments on commit 4b83c91

Please sign in to comment.