Changes in / [c1c09285:8f62de7]


Ignore:
Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    rc1c09285 r8f62de7  
    483483
    484484        void ReturnChecker::visit( ReturnStmt * returnStmt ) {
    485                 // Previously this also checked for the existence of an expr paired with no return values on
    486                 // the  function return type. This is incorrect, since you can have an expression attached to
    487                 // a return statement in a void-returning function in C. The expression is treated as if it
    488                 // were cast to void.
    489485                if ( returnStmt->get_expr() == NULL && returnVals.size() != 0 ) {
    490486                        throw SemanticError( "Non-void function returns no values: " , returnStmt );
     487                } else if ( returnStmt->get_expr() != NULL && returnVals.size() == 0 ) {
     488                        throw SemanticError( "void function returns values: " , returnStmt );
    491489                }
    492490        }
  • src/SynTree/Statement.cc

    rc1c09285 r8f62de7  
    399399}
    400400
    401 ImplicitCtorDtorStmt::ImplicitCtorDtorStmt( const ImplicitCtorDtorStmt & other ) : Statement( other ), callStmt( maybeClone( other.callStmt ) ) {
     401ImplicitCtorDtorStmt::ImplicitCtorDtorStmt( const ImplicitCtorDtorStmt & other ) : Statement( other ), callStmt( other.callStmt ) {
    402402}
    403403
    404404ImplicitCtorDtorStmt::~ImplicitCtorDtorStmt() {
    405         delete callStmt;
    406405}
    407406
Note: See TracChangeset for help on using the changeset viewer.