Incorrect type for ref.func when function references are enabled
The following wat program works fine in wat2wasm without function references enabled:
(module
(func $example (export "example") (result funcref)
ref.func $example))
However, enabling the "function references" feature causes the following error:
Error: validate failed:
test.wast:3:5: error: type mismatch in implicit return, expected [funcref] but got [(ref 0)]
ref.func $example))
^^^^^^^^
It looks like ref 0 is not marked as a subtype of funcref.
Tested with the online demo: https://webassembly.github.io/wabt/demo/wat2wasm/
Thank you for testing this! As with https://github.com/WebAssembly/wabt/issues/2097 and https://github.com/WebAssembly/wabt/issues/1986 and https://github.com/WebAssembly/wabt/issues/1987 and #2089, AFAIK support for the function-references proposal remains a work in progress in WABT. We don't even mention function references in the README, and we're not running the function-references tests. (I think function-references may have been folded into the "gc" proposal in the meantime, but not sure?)
I think somebody who is interested in pushing this forward will have to complete support for the function-references or gc proposals, and claim support in the README, and add the proposal spec tests to WABT's testsuite, before we'd expect function references to work properly. Closing as essentially a dup of #1377 . If you want to work on this, we'd be very happy to help / review contributions that get these proposals supported!