]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
d: Adjust backport of PR96250 for front-end implementation.
authorIain Buclaw <ibuclaw@gdcproject.org>
Thu, 20 Aug 2020 23:52:28 +0000 (01:52 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Thu, 20 Aug 2020 23:52:28 +0000 (01:52 +0200)
gcc/d/ChangeLog:

2020-08-21  Iain Buclaw  <ibuclaw@gdcproject.org>

PR d/96250
* dmd/expressionsem.c (ExpressionSemanticVisitor::visit(TypeExp)):
Fix cast from Expression to VarExp.

gcc/d/dmd/expressionsem.c

index 562c2a60426cdb91fdce31b44191820df43d01d2..559c656e65406b9c74413f303fb2e963dc6be04d 100644 (file)
@@ -815,7 +815,7 @@ public:
             // `(Type)` is actually `(var)` so if `(var)` is a member requiring `this`
             // then rewrite as `(this.var)` in case it would be followed by a DotVar
             // to fix https://issues.dlang.org/show_bug.cgi?id=9490
-            VarExp *ve = e->isVarExp();
+            VarExp *ve = (e->op == TOKvar) ? (VarExp *)e : NULL;
             if (ve && ve->var && exp->parens && !ve->var->isStatic() && !(sc->stc & STCstatic) &&
                 sc->func && sc->func->needThis() && ve->var->toParent2()->isAggregateDeclaration())
             {