diff options
-rw-r--r-- | src/validator.cc | 10 | ||||
-rw-r--r-- | test/regress/regress-22.txt | 14 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/validator.cc b/src/validator.cc index 58a36cd5..08976f2a 100644 --- a/src/validator.cc +++ b/src/validator.cc @@ -602,10 +602,7 @@ Result Validator::OnCallIndirectExpr(CallIndirectExpr* expr) { if (current_module_->tables.size() == 0) { PrintError(&expr->loc, "found call_indirect operator, but no table"); } - if (expr->decl.has_func_type) { - const FuncType* func_type; - CheckFuncTypeVar(&expr->decl.type_var, &func_type); - } + CheckFuncSignature(&expr->loc, expr->decl); typechecker_.OnCallIndirect(expr->decl.sig.param_types, expr->decl.sig.result_types); return Result::Ok; @@ -812,10 +809,7 @@ Result Validator::OnReturnCallIndirectExpr(ReturnCallIndirectExpr* expr) { if (current_module_->tables.empty()) { PrintError(&expr->loc, "found return_call_indirect operator, but no table"); } - if (expr->decl.has_func_type) { - const FuncType* func_type; - CheckFuncTypeVar(&expr->decl.type_var, &func_type); - } + CheckFuncSignature(&expr->loc, expr->decl); typechecker_.OnReturnCallIndirect(expr->decl.sig.param_types, expr->decl.sig.result_types); return Result::Ok; diff --git a/test/regress/regress-22.txt b/test/regress/regress-22.txt new file mode 100644 index 00000000..70ae4d17 --- /dev/null +++ b/test/regress/regress-22.txt @@ -0,0 +1,14 @@ +;;; TOOL: wat2wasm +;;; ERROR: 1 +(module + (type $sig (func (param i32) (result i32))) + (table 0 anyfunc) + (func (result i32) + (call_indirect (type $sig) (result i32) (i32.const 0)) + ) +) +(;; STDERR ;;; +out/test/regress/regress-22.txt:7:8: error: expected 1 arguments, got 0 + (call_indirect (type $sig) (result i32) (i32.const 0)) + ^^^^^^^^^^^^^ +;;; STDERR ;;) |