From: Iain Buclaw Date: Thu, 20 Aug 2020 23:52:28 +0000 (+0200) Subject: d: Adjust backport of PR96250 for front-end implementation. X-Git-Tag: releases/gcc-10.3.0~1014 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf465206b7012a9049821c68236093969d7767da;p=thirdparty%2Fgcc.git d: Adjust backport of PR96250 for front-end implementation. gcc/d/ChangeLog: 2020-08-21 Iain Buclaw PR d/96250 * dmd/expressionsem.c (ExpressionSemanticVisitor::visit(TypeExp)): Fix cast from Expression to VarExp. --- diff --git a/gcc/d/dmd/expressionsem.c b/gcc/d/dmd/expressionsem.c index 562c2a60426c..559c656e6540 100644 --- a/gcc/d/dmd/expressionsem.c +++ b/gcc/d/dmd/expressionsem.c @@ -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()) {