From 91a5c8acbdcf6310475c412232b9b03f7aa8c133 Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Tue, 14 Jan 2014 13:10:02 -0800 Subject: [PATCH] fix Issue 11922 - [REG2.065a] ICE on nonexistent identifier in templated auto method --- src/expression.c | 2 +- test/fail_compilation/ice11922.d | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 test/fail_compilation/ice11922.d diff --git a/src/expression.c b/src/expression.c index fd78ee61c813..f8008f5fac5a 100644 --- a/src/expression.c +++ b/src/expression.c @@ -8775,7 +8775,7 @@ Expression *CallExp::semantic(Scope *sc) // Do overload resolution f = resolveFuncCall(loc, sc, s, tiargs, ue1 ? ue1->type : NULL, arguments); - if (!f) + if (!f || f->type->ty == Terror) return new ErrorExp(); if (f->needThis()) diff --git a/test/fail_compilation/ice11922.d b/test/fail_compilation/ice11922.d new file mode 100644 index 000000000000..6302f3fe997b --- /dev/null +++ b/test/fail_compilation/ice11922.d @@ -0,0 +1,18 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice11922.d(11): Error: undefined identifier a +fail_compilation/ice11922.d(17): Error: template instance ice11922.S.f!int error instantiating +--- +*/ + +struct S +{ + auto f(B)(B) { return a; } +} + +void main() +{ + S s; + s.f(5); +}