emscripten-core / emscripten-core/emscripten

[embind] Using `EMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0` fails with polymorphic types

Open
#21,619 4 comments 0 reactions 1 assignee Claimed by @sbc100 View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

The `EMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0` feature seems to not work with polymorphic types.

Adding a flavor of `other.test_embind` that builds with `EMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0` causes the test to fail with:

```
Error: expected: PolyDerived, actual: PolyBase
at Object.assert.equal (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:6055:18)
at Object. (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:6688:20)
at runTest (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:5887:23)
at run_all (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:5907:26)
at run_all_tests (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:6410:5)
at Object. (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:9366:5)
at Module._compile (node:internal/modules/cjs/loader:1196:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47
error: Error: expected: PolyDerived, actual: PolyBase
at Object.assert.equal (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:6055:18)
at Object. (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:6688:20)
at runTest (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:5887:23)
at run_all (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:5907:26)
at run_all_tests (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:6410:5)
at Object. (/usr/local/google/home/sbc/dev/wasm/emscripten/out/test/embind_test.js:9366:5)
at Module._compile (node:internal/modules/cjs/loader:1196:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47 {
info: { Expected: 'PolyDerived', Actual: 'PolyBase' }
}
```

I believe this is because `getLightTypeID()` is able to inspect the type of a value when `EMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES` is enabled but other wise it only looks at the type `T` and not the `value`: https://github.com/emscripten-core/emscripten/blob/d99707c10d916cdb2064c38216ab7304cdb781c0/system/include/emscripten/wire.h#L85-L95

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.