Skip to content

Binding error when overload the constructor #9704

Description

@akineeic

Hello,

I'm getting an error when trying to overload the constructor of Runtimeshape (class of tflite).

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

  • The binding code

class_<RuntimeShape>("RuntimeShape")
    .constructor<int>(select_overload<RuntimeShape(int)>([](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<int>'
            invoker::template invoke<ClassType, Policies...>(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_<tflite::RuntimeShape,
      emscripten::internal::NoBaseClass>::constructor<int, (lambda at /home/zzm/projects/webml-polyfill/src/nn/wasm/src/bind/src/binding.cpp:387:23)>' requested here
    .constructor<int>([](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_<tflite::RuntimeShape,
      emscripten::internal::NoBaseClass>'
            invoker::template invoke<ClassType, Policies...>(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. So how should I modify my code to fix the bug?

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions