From 002cafcb04ffa8880776da0a4e013f0923c54364 Mon Sep 17 00:00:00 2001 From: k-hara Date: Sat, 5 Jul 2014 04:29:13 +0900 Subject: [PATCH] fix Issue 13027 - Assertion `ex->op == TOKblit || ex->op == TOKconstruct' failed. --- src/declaration.c | 4 ++-- test/fail_compilation/ice13027.d | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 test/fail_compilation/ice13027.d diff --git a/src/declaration.c b/src/declaration.c index 81846ba504a2..733c7c69e780 100644 --- a/src/declaration.c +++ b/src/declaration.c @@ -1541,8 +1541,8 @@ void VarDeclaration::semantic(Scope *sc) Expression *ex = ei->exp; while (ex->op == TOKcomma) ex = ((CommaExp *)ex)->e2; - assert(ex->op == TOKblit || ex->op == TOKconstruct); - ex = ((AssignExp *)ex)->e2; + if (ex->op == TOKblit || ex->op == TOKconstruct) + ex = ((AssignExp *)ex)->e2; if (ex->op == TOKnew) { // See if initializer is a NewExp that can be allocated on the stack diff --git a/test/fail_compilation/ice13027.d b/test/fail_compilation/ice13027.d new file mode 100644 index 000000000000..04ccdf3e4f7e --- /dev/null +++ b/test/fail_compilation/ice13027.d @@ -0,0 +1,10 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice13027.d(9): Error: template instance b!"c" template 'b' is not defined +--- +*/ +void main() +{ + scope a = b!"c"; +}