Changes in / [535adab:d298e03]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r535adab rd298e03  
    896896                        Parent::visit( compoundStmt );
    897897
    898                         // add destructors for the current scope that we're exiting
     898                        // add destructors for the current scope that we're exiting, unless the last statement is a return, which
     899                        // causes unreachable code warnings
    899900                        std::list< Statement * > & statements = compoundStmt->get_kids();
    900                         insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) );
     901                        if ( ! statements.empty() && ! dynamic_cast< ReturnStmt * >( statements.back() ) ) {
     902                                insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) );
     903                        }
    901904                        reverseDeclOrder.pop_front();
    902905                }
Note: See TracChangeset for help on using the changeset viewer.