diff --git a/src/Stmt.cc b/src/Stmt.cc index 0d5306cf91..4618904de8 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -1249,7 +1249,7 @@ ForStmt::ForStmt(IDPList* arg_loop_vars, ExprPtr loop_expr) else if ( lvt ) { if ( ! same_type(lvt, ind_type) ) - lvt->Error("type clash in iteration", ind_type.get()); + e->Error("type clash in iteration", lvt.get()); } else @@ -1341,7 +1341,7 @@ ForStmt::ForStmt(IDPList* arg_loop_vars, ExprPtr loop_expr, IDPtr val_var) else if ( value_var->GetType() ) { if ( ! same_type(value_var->GetType(), yield_type) ) - value_var->GetType()->Error("type clash in iteration", yield_type.get()); + e->Error("type clash in iteration", value_var->GetType().get()); } else add_local(value_var, yield_type, INIT_NONE, nullptr, nullptr, VAR_REGULAR); diff --git a/testing/btest/Baseline/language.for-var-check/out b/testing/btest/Baseline/language.for-var-check/out index 4d222556e0..7ec93ac368 100644 --- a/testing/btest/Baseline/language.for-var-check/out +++ b/testing/btest/Baseline/language.for-var-check/out @@ -1,5 +1,5 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. error in <...>/for-var-check.zeek, line 4: global variable used in 'for' loop (x) -error in error and count: type clash in iteration (error and count) +error in <...>/for-var-check.zeek, line 10 and error: type clash in iteration (set(1, 2, 3) and error) error in <...>/for-var-check.zeek, line 8: constant used in 'for' loop (y) -error in error and count: type clash in iteration (error and count) +error in <...>/for-var-check.zeek, line 11 and error: type clash in iteration (set(1, 2, 3) and error)