diff options
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 393d28c1e..7a4bb6a97 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2586,10 +2586,12 @@ void FunctionValidator::visitStructNew(StructNew* curr) { "struct.new must have the right number of operands")) { // All the fields must have the proper type. for (Index i = 0; i < fields.size(); i++) { - shouldBeSubType(curr->operands[i]->type, - fields[i].type, - curr, - "struct.new operand must have proper type"); + if (!Type::isSubType(curr->operands[i]->type, fields[i].type)) { + info.fail("struct.new operand " + std::to_string(i) + + " must have proper type", + curr, + getFunction()); + } } } } |