aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/dmd/optimize.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/d/dmd/optimize.d')
-rw-r--r--gcc/d/dmd/optimize.d2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/d/dmd/optimize.d b/gcc/d/dmd/optimize.d
index 3ae3061..9f116fe 100644
--- a/gcc/d/dmd/optimize.d
+++ b/gcc/d/dmd/optimize.d
@@ -697,6 +697,8 @@ Expression Expression_optimize(Expression e, int result, bool keepLvalue)
// See if we can remove an unnecessary cast
ClassDeclaration cdfrom = e.e1.type.isClassHandle();
ClassDeclaration cdto = e.type.isClassHandle();
+ if (cdfrom.errors || cdto.errors)
+ return error();
if (cdto == ClassDeclaration.object && !cdfrom.isInterfaceDeclaration())
goto L1; // can always convert a class to Object
// Need to determine correct offset before optimizing away the cast.