Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    redbdbe6 ra4dd728  
    361361                                        FunctionType * ftype = dynamic_cast< FunctionType * >( GenPoly::getFunctionType( funcDecl->get_type() ) );
    362362                                        assert( ftype );
    363                                         if ( isConstructor( funcDecl->get_name() ) && ftype->get_parameters().size() == 2 ) {
     363                                        if ( (isConstructor( funcDecl->get_name() ) || funcDecl->get_name() == "?=?") && ftype->get_parameters().size() == 2 ) {
    364364                                                Type * t1 = ftype->get_parameters().front()->get_type();
    365365                                                Type * t2 = ftype->get_parameters().back()->get_type();
     
    367367
    368368                                                if ( ResolvExpr::typesCompatible( ptrType->get_base(), t2, SymTab::Indexer() ) ) {
    369                                                         // optimization: don't need to copy construct in order to call a copy constructor
     369                                                        // optimization: don't need to copy construct in order to call a copy constructor or
     370                                                        // assignment operator
    370371                                                        return appExpr;
    371372                                                } // if
     
    635636                                assert( ! stmtExpr->get_returnDecls().empty() );
    636637                                body->get_kids().push_back( new ExprStmt( noLabels, new VariableExpr( stmtExpr->get_returnDecls().front() ) ) );
    637                                 stmtExpr->get_returnDecls().clear();
    638                                 stmtExpr->get_dtors().clear();
    639                         }
    640                         assert( stmtExpr->get_returnDecls().empty() );
    641                         assert( stmtExpr->get_dtors().empty() );
     638                        }
     639                        stmtExpr->get_returnDecls().clear();
     640                        stmtExpr->get_dtors().clear();
    642641                        return stmtExpr;
    643642                }
     
    656655                                unqExpr->set_result( maybeClone( unqExpr->get_expr()->get_result() ) );
    657656                                if ( unqCount[ unqExpr->get_id() ] == 0 ) {  // insert destructor after the last use of the unique expression
    658                                         stmtsToAddAfter.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );
     657                                        stmtsToAdd.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );
    659658                                }
    660659                                if ( addDeref.count( unqExpr->get_id() ) ) {
     
    668667                        stmtsToAdd.splice( stmtsToAdd.end(), fixer.stmtsToAdd );
    669668                        unqMap[unqExpr->get_id()] = unqExpr;
    670                         if ( unqCount[ unqExpr->get_id() ] == 0 ) {  // insert destructor after the last use of the unique expression
    671                                 stmtsToAddAfter.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );
    672                         } else { // remember dtors for last instance of unique expr
    673                                 dtors[ unqExpr->get_id() ] = fixer.stmtsToAddAfter;
    674                         }
    675669                        if ( UntypedExpr * deref = dynamic_cast< UntypedExpr * >( unqExpr->get_expr() ) ) {
    676670                                // unique expression is now a dereference, because the inner expression is an lvalue returning function call.
     
    681675                                getCallArg( deref, 0 ) = unqExpr;
    682676                                addDeref.insert( unqExpr->get_id() );
     677                                if ( unqCount[ unqExpr->get_id() ] == 0 ) {  // insert destructor after the last use of the unique expression
     678                                        stmtsToAdd.splice( stmtsToAddAfter.end(), dtors[ unqExpr->get_id() ] );
     679                                } else { // remember dtors for last instance of unique expr
     680                                        dtors[ unqExpr->get_id() ] = fixer.stmtsToAddAfter;
     681                                }
    683682                                return deref;
    684683                        }
Note: See TracChangeset for help on using the changeset viewer.