diff --git a/src/expression.c b/src/expression.c index 79ee88c951ed..0c0ffeffbc4f 100644 --- a/src/expression.c +++ b/src/expression.c @@ -8161,25 +8161,6 @@ Expression *DotTemplateInstanceExp::semanticY(Scope *sc, int flag) Declaration *v = s->isDeclaration(); 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 - * type as the enclosing template instantiation. This results in a nested instantiation, - * which of course gets short circuited. The return type then gets set to - * the template instance type before instantiation, rather than after. - * We can detect this by the deco not being set. If so, go ahead and retry - * the return type semantic. - * The offending code is the return type from std.typecons.Tuple.slice: - * ref Tuple!(Types[from .. to]) slice(uint from, uint to)() - * { - * return *cast(typeof(return) *) &(field[from]); - * } - * and this line from the following unittest: - * auto s = a.slice!(1, 3); - * where s's type wound up not having semantic() run on it. - */ - if (v->type && !v->type->deco) - v->type = v->type->semantic(v->loc, sc); - e = new DotVarExp(loc, eleft, v); e = e->semantic(sc); return e; diff --git a/test/fail_compilation/ice10938.d b/test/fail_compilation/ice10938.d new file mode 100644 index 000000000000..2b3eab52ea3f --- /dev/null +++ b/test/fail_compilation/ice10938.d @@ -0,0 +1,23 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice10938.d(12): Error: no property 'opts' for type 'ice10938.C' +--- +*/ + +class C +{ + this() + { + this.opts["opts"] = 1; + } + + auto opDispatch(string field : "opts")() + { + return this.opts; // ICE -> compile time error + } +} + +void main() +{ +}