@@ -776,7 +776,7 @@ class ToElemVisitor : public Visitor {
776776 auto &PGO = gIR ->func ()->pgo ;
777777 PGO.setCurrentStmt (e);
778778
779- DValue *l = toElem (e->e1 );
779+ DRValue *l = toElem (e->e1 )-> getRVal ( );
780780
781781 Type *t = e->type ->toBasetype ();
782782 Type *e1type = e->e1 ->type ->toBasetype ();
@@ -788,9 +788,9 @@ class ToElemVisitor : public Visitor {
788788 Logger::println (" Adding integer to pointer" );
789789 result = emitPointerOffset (p, e->loc , l, e->e2 , false , e->type );
790790 } else if (t->iscomplex ()) {
791- result = DtoComplexAdd (e->loc , e->type , l, toElem (e->e2 ));
791+ result = DtoComplexAdd (e->loc , e->type , l, toElem (e->e2 )-> getRVal () );
792792 } else {
793- result = DtoBinAdd (l, toElem (e->e2 ));
793+ result = DtoBinAdd (l, toElem (e->e2 )-> getRVal () );
794794 }
795795 }
796796
@@ -802,7 +802,7 @@ class ToElemVisitor : public Visitor {
802802 auto &PGO = gIR ->func ()->pgo ;
803803 PGO.setCurrentStmt (e);
804804
805- DValue *l = toElem (e->e1 );
805+ DRValue *l = toElem (e->e1 )-> getRVal ( );
806806
807807 Type *t = e->type ->toBasetype ();
808808 Type *t1 = e->e1 ->type ->toBasetype ();
@@ -825,9 +825,9 @@ class ToElemVisitor : public Visitor {
825825 Logger::println (" Subtracting integer from pointer" );
826826 result = emitPointerOffset (p, e->loc , l, e->e2 , true , e->type );
827827 } else if (t->iscomplex ()) {
828- result = DtoComplexSub (e->loc , e->type , l, toElem (e->e2 ));
828+ result = DtoComplexSub (e->loc , e->type , l, toElem (e->e2 )-> getRVal () );
829829 } else {
830- result = DtoBinSub (l, toElem (e->e2 ));
830+ result = DtoBinSub (l, toElem (e->e2 )-> getRVal () );
831831 }
832832 }
833833
@@ -841,8 +841,8 @@ class ToElemVisitor : public Visitor {
841841 auto &PGO = gIR ->func ()->pgo ;
842842 PGO.setCurrentStmt (e);
843843
844- DValue *l = toElem (e->e1 );
845- DValue *r = toElem (e->e2 );
844+ DRValue *l = toElem (e->e1 )-> getRVal ( );
845+ DRValue *r = toElem (e->e2 )-> getRVal ( );
846846
847847 errorOnIllegalArrayOp (e, e->e1 , e->e2 );
848848
@@ -863,8 +863,8 @@ class ToElemVisitor : public Visitor {
863863 auto &PGO = gIR ->func ()->pgo ;
864864 PGO.setCurrentStmt (e);
865865
866- DValue *l = toElem (e->e1 );
867- DValue *r = toElem (e->e2 );
866+ DRValue *l = toElem (e->e1 )-> getRVal ( );
867+ DRValue *r = toElem (e->e2 )-> getRVal ( );
868868
869869 errorOnIllegalArrayOp (e, e->e1 , e->e2 );
870870
@@ -885,8 +885,8 @@ class ToElemVisitor : public Visitor {
885885 auto &PGO = gIR ->func ()->pgo ;
886886 PGO.setCurrentStmt (e);
887887
888- DValue *l = toElem (e->e1 );
889- DValue *r = toElem (e->e2 );
888+ DRValue *l = toElem (e->e1 )-> getRVal ( );
889+ DRValue *r = toElem (e->e2 )-> getRVal ( );
890890
891891 errorOnIllegalArrayOp (e, e->e1 , e->e2 );
892892
@@ -2418,14 +2418,14 @@ class ToElemVisitor : public Visitor {
24182418 e->type ->toChars ());
24192419 LOG_SCOPE;
24202420
2421- DValue *l = toElem (e->e1 );
2421+ DRValue *dval = toElem (e->e1 )-> getRVal ( );
24222422
24232423 if (e->type ->iscomplex ()) {
2424- result = DtoComplexNeg (e->loc , e->type , l );
2424+ result = DtoComplexNeg (e->loc , e->type , dval );
24252425 return ;
24262426 }
24272427
2428- LLValue *val = DtoRVal (l );
2428+ LLValue *val = DtoRVal (dval );
24292429
24302430 if (e->type ->isintegral ()) {
24312431 val = p->ir ->CreateNeg (val, " negval" );
0 commit comments