Changeset 5002738


Ignore:
Timestamp:
Apr 10, 2018, 3:14:36 PM (5 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
207b496
Parents:
10246645
Message:

Update createBitwiseAssignment to work for multilevel references

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    r10246645 r5002738  
    528528                }
    529529                if ( dynamic_cast< ReferenceType * >( dst->result ) ) {
    530                         dst = new AddressExpr( dst );
     530                        for (int depth = dst->result->referenceDepth(); depth > 0; depth--) {
     531                                dst = new AddressExpr( dst );
     532                        }
    531533                } else {
    532534                        dst = new CastExpr( dst, new ReferenceType( noQualifiers, dst->result->clone() ) );
    533535                }
    534536                if ( dynamic_cast< ReferenceType * >( src->result ) ) {
    535                         src = new CastExpr( src, new ReferenceType( noQualifiers, src->result->stripReferences()->clone() ) );
     537                        for (int depth = src->result->referenceDepth(); depth > 0; depth--) {
     538                                src = new AddressExpr( src );
     539                        }
    536540                }
    537541                return new ApplicationExpr( VariableExpr::functionPointer( assign ), { dst, src } );
Note: See TracChangeset for help on using the changeset viewer.