emscripten-core / emscripten-core/emscripten

bind failure with register_vector / "implicit instantiation of undefined template"

Open
#9,005 7 comments 2 reactions 0 assignees View on GitHub
embind help wanted wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Previously (emscripten-1.38.29), this code snippet worked and compiled without error:

```
std::vector VectorAPI::createStringVector()
{
return std::vector();
}

EMSCRIPTEN_BINDINGS(VectorAPI)
{
class_("VectorAPI")
.class_function("createStringVector", &VectorAPI::createStringVector);
register_vector("vector");
}
```

However, on the latest version, I get this instead:

```
In file included from src/api/VectorAPI.cpp:3:
In file included from src/api/VectorAPI.h:6:
/mnt/c/git/emsdk/upstream/emscripten/system/include/emscripten/bind.h:1423:13: error: implicit instantiation of undefined template 'emscripten::internal::RegisterClassMethod, std::__2::allocator > >::*)() const noexcept>'
invoker::template invoke(methodName, callable);
^
/mnt/c/git/emsdk/upstream/emscripten/system/include/emscripten/bind.h:1600:14: note: in instantiation of function template specialization 'emscripten::class_, std::__2::allocator > >, emscripten::internal::NoBaseClass>::function, std::__2::allocator > >::*)() const noexcept>' requested here
.function("size", &VecType::size)
^
src/api/VectorAPI.cpp:26:5: note: in instantiation of function template specialization 'emscripten::register_vector >' requested here
register_vector("vector");
^
/mnt/c/git/emsdk/upstream/emscripten/system/include/emscripten/bind.h:1150:16: note: template is declared here
struct RegisterClassMethod;
^
1 error generated.
shared:ERROR: compiler frontend failed to generate LLVM bitcode, halting
```

I have verified that I'm receiving the same error no matter what vector type I attempt to register (including primitives). I unfortunately can't stay on the older Emscripten version, due to some other issues.

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.