Changeset 6bbce58


Ignore:
Timestamp:
Oct 5, 2017, 11:53:47 AM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
6545adff
Parents:
f585450
Message:

Fix bug where explode removes non-reference casts in tuple assignment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tuples/Explode.h

    rf585450 r6bbce58  
    3030        Expression * distributeReference( Expression * );
    3131
     32        static inline CastExpr * isReferenceCast( Expression * expr ) {
     33                if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
     34                        if ( dynamic_cast< ReferenceType * >( castExpr->result ) ) {
     35                                return castExpr;
     36                        }
     37                }
     38                return nullptr;
     39        }
     40
    3241        /// helper function used by explode
    3342        template< typename OutputIterator >
     
    3544                if ( isTupleAssign ) {
    3645                        // tuple assignment needs CastExprs to be recursively exploded to easily get at all of the components
    37                         if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
     46                        if ( CastExpr * castExpr = isReferenceCast( expr ) ) {
    3847                                ResolvExpr::AltList alts;
    3948                                explodeUnique( castExpr->get_arg(), alt, indexer, back_inserter( alts ), isTupleAssign );
Note: See TracChangeset for help on using the changeset viewer.