From 54d6e35d46c7af02dbb718812834e084354c31b5 Mon Sep 17 00:00:00 2001 From: k-hara Date: Mon, 18 Nov 2013 23:30:30 +0900 Subject: [PATCH] fix Issue 7645 - ICE(e2ir.c) nested classes --- src/expression.c | 2 ++ test/fail_compilation/ice7645.d | 32 ++++++++++++++++++++++++++++++++ test/fail_compilation/ice9545.d | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 test/fail_compilation/ice7645.d diff --git a/src/expression.c b/src/expression.c index 2704bbef90ab..4da72cc62aab 100644 --- a/src/expression.c +++ b/src/expression.c @@ -10670,6 +10670,8 @@ Expression *DotExp::semantic(Scope *sc) return e; } } + if (e2->op == TOKtype) + return e2; if (!type) type = e2->type; return this; diff --git a/test/fail_compilation/ice7645.d b/test/fail_compilation/ice7645.d new file mode 100644 index 000000000000..cc967cada993 --- /dev/null +++ b/test/fail_compilation/ice7645.d @@ -0,0 +1,32 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice7645.d(28): Error: need 'this' for 't' of type 'char' +fail_compilation/ice7645.d(31): Error: need 'this' for 'fn' of type 'pure nothrow @safe void()' +--- +*/ + +class C +{ + class C2() + { + char t; + } +} + +struct S +{ + struct S2(T) + { + void fn() {} + } +} + +void main() +{ + C c; + auto v = c.C2!().t; + + S s; + s.S2!int.fn(); +} diff --git a/test/fail_compilation/ice9545.d b/test/fail_compilation/ice9545.d index b467d91e9f0c..846975afd3bc 100644 --- a/test/fail_compilation/ice9545.d +++ b/test/fail_compilation/ice9545.d @@ -2,7 +2,7 @@ /* TEST_OUTPUT: ---- -fail_compilation/ice9545.d(13): Error: expression has no value +fail_compilation/ice9545.d(13): Error: type int has no value ---- */