diff options
-rw-r--r-- | src/wasm/wasm-type.cpp | 2 | ||||
-rw-r--r-- | test/lit/validation/open-types-no-gc.wast | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index b14e5aa39..5957f9388 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -933,7 +933,7 @@ FeatureSet Type::getFeatures() const { if (heapType->isStruct() || heapType->isArray() || heapType->getRecGroup().size() > 1 || - heapType->getDeclaredSuperType()) { + heapType->getDeclaredSuperType() || heapType->isOpen()) { feats |= FeatureSet::ReferenceTypes | FeatureSet::GC; } else if (heapType->isSignature()) { // This is a function reference, which requires reference types and diff --git a/test/lit/validation/open-types-no-gc.wast b/test/lit/validation/open-types-no-gc.wast new file mode 100644 index 000000000..189d4e464 --- /dev/null +++ b/test/lit/validation/open-types-no-gc.wast @@ -0,0 +1,13 @@ +;; Test that declaring non-final types without GC is a validation error. + +;; RUN: not wasm-opt %s -all --disable-gc 2>&1 | filecheck %s + +;; CHECK: all used types should be allowed + +(module + (type $f1 (sub (func))) + + (func $test (type $f1) + (unreachable) + ) +)
\ No newline at end of file |