emscripten-core / emscripten-core/emscripten

Binding error when overload the constructor

Open
#9,704 3 comments 0 reactions 1 assignee Claimed by @jgravelle-google View on GitHub
embind wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Hello,

I'm getting an error when trying to overload the constructor of [Runtimeshape](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/kernels/internal/types.h#L129-L129) (class of tflite).

- Environment Info
OS => Ubuntu 18.04
Emscripten => fastcomp 1.38.41 or later
Tensorflow => 1.13

- The [binding code](https://github.com/intel/webml-polyfill/blob/master/src/nn/wasm/src/bind/src/binding.cpp#L396-L400)
```
class_("RuntimeShape")
.constructor(select_overload([](int dimensions_count) {
return RuntimeShape(dimensions_count);
}
))
```

- Error message:
```
In file included from /home/zzm/projects/webml-polyfill/src/nn/wasm/src/bind/src/binding.cpp:1:
/home/zzm/software/emsdk/fastcomp/emscripten/system/include/emscripten/bind.h:1391:13: error: implicit instantiation of undefined template 'emscripten::internal::RegisterClassConstructor'
invoker::template invoke(callable);
^
/home/zzm/projects/webml-polyfill/src/nn/wasm/src/bind/src/binding.cpp:387:6: note: in instantiation of function template specialization 'emscripten::class_::constructor' requested here
.constructor([](int dimensions_count) {
^
/home/zzm/software/emsdk/fastcomp/emscripten/system/include/emscripten/bind.h:1144:16: note: template is declared here
struct RegisterClassConstructor;
^
/home/zzm/software/emsdk/fastcomp/emscripten/system/include/emscripten/bind.h:1391:31: error: no member named 'invoke' in 'emscripten::class_'
invoker::template invoke(callable);
^
```

I have tested with different version, the bind code works well on version with 1.38.40 but failed with 1.38.41. According to the source code, I found it may caused by the rewrite of emscripten::class_::constructor in this [commit](https://github.com/emscripten-core/emscripten/commit/ecb7bb3dcf8cc9f188cdbbc62877c2f4ad87a386#diff-b89415f247dd9bc4a13f065288c5e651). So how should I modify my code to fix the bug?

Thanks.

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.