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 ---- */