Permalink
Browse files

Merge pull request #1461 from AndrejMitrovic/Fix9291

Issue 9291 - ICE on throwing undefined identifier
  • Loading branch information...
2 parents 98e20bc + 3e585b4 commit 1eb2bf2ebf8203ea5fdf7fe92aa946bbde6e9c30 @9rnsr 9rnsr committed Jan 11, 2013
Showing with 14 additions and 2 deletions.
  1. +3 −2 src/statement.c
  2. +11 −0 test/fail_compilation/ice9291.d
View
5 src/statement.c
@@ -5006,9 +5006,10 @@ Statement *ThrowStatement::semantic(Scope *sc)
int ThrowStatement::blockExit(bool mustNotThrow)
{
- if (mustNotThrow)
+ Type *t = exp->type->toBasetype();
+ if (mustNotThrow && t->ty != Terror)
{
- ClassDeclaration *cd = exp->type->toBasetype()->isClassHandle();
+ ClassDeclaration *cd = t->isClassHandle();
assert(cd);
// Bugzilla 8675
View
11 test/fail_compilation/ice9291.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9291.d(10): Error: undefined identifier F
+---
+*/
+
+void main() nothrow
+{
+ throw new F();
+}

0 comments on commit 1eb2bf2

Please sign in to comment.