Permalink
Browse files

Fixes Issue 9291 - ICE on throwing undefined identifier.

  • Loading branch information...
AndrejMitrovic committed Jan 10, 2013
1 parent bc8b981 commit 3e585b4c79fdfb34bb5f75da935783ecb80a74d9
Showing with 14 additions and 2 deletions.
  1. +3 −2 src/statement.c
  2. +11 −0 test/fail_compilation/ice9291.d
View
@@ -5005,9 +5005,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
@@ -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 3e585b4

Please sign in to comment.