summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index bf29f948b..d8a3c2f74 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -6898,6 +6898,9 @@ void WasmBinaryBuilder::visitRefAs(RefAs* curr, uint8_t code) {
WASM_UNREACHABLE("invalid code for ref.as_*");
}
curr->value = popNonVoidExpression();
+ if (!curr->value->type.isRef() && curr->value->type != Type::unreachable) {
+ throwError("bad input type for ref.as: " + curr->value->type.toString());
+ }
curr->finalize();
}