avoid evaluating calls to determine whether an expression value is ignored

This commit is contained in:
Vern Paxson 2022-03-11 14:20:09 -08:00 committed by Tim Wojtulewicz
parent 4d051620e8
commit 72b937bfdf

View file

@ -396,7 +396,7 @@ void do_print_stmt(const std::vector<ValPtr>& vals)
ExprStmt::ExprStmt(ExprPtr arg_e) : Stmt(STMT_EXPR), e(std::move(arg_e)) ExprStmt::ExprStmt(ExprPtr arg_e) : Stmt(STMT_EXPR), e(std::move(arg_e))
{ {
if ( e && e->IsPure() && e->GetType()->Tag() != TYPE_ERROR ) if ( e && e->Tag() != EXPR_CALL && e->IsPure() && e->GetType()->Tag() != TYPE_ERROR )
Warn("expression value ignored"); Warn("expression value ignored");
SetLocationInfo(e->GetLocationInfo()); SetLocationInfo(e->GetLocationInfo());