Changes in src/SymTab/Validate.cc [74d1804:a436947]
- File:
-
- 1 edited
-
src/SymTab/Validate.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
r74d1804 ra436947 483 483 484 484 void ReturnChecker::visit( ReturnStmt * returnStmt ) { 485 // Previously this also checked for the existence of an expr paired with no return values on486 // the function return type. This is incorrect, since you can have an expression attached to487 // a return statement in a void-returning function in C. The expression is treated as if it488 // were cast to void.489 485 if ( returnStmt->get_expr() == NULL && returnVals.size() != 0 ) { 490 486 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 ); 491 489 } 492 490 }
Note:
See TracChangeset
for help on using the changeset viewer.