scapix icon indicating copy to clipboard operation
scapix copied to clipboard

Getting `multiple overloads of 'tuple_base' instantiate to the same signature 'void ()'` error

Open TimPushkin opened this issue 2 years ago • 1 comments

I'm getting errors like this trying to build a project with Scapix:

In file included from /<my project>/generated/bridge/java/my_class.cpp:4:
In file included from /home/<my username>/.cmodule/scapix/1.0.30/source/scapix/bridge/java/init.h:10:
In file included from /home/<my username>/.cmodule/scapix/1.0.30/source/scapix/link/java/native_method.h:10:
/home/<my username>/.cmodule/scapix/1.0.30/source/scapix/core/tuple.h:33:12: error: multiple overloads of 'tuple_base' instantiate to the same signature 'void ()'
        constexpr tuple_base(Types... values) : tuple_value<Indexes, Types>{ values }... {}
                  ^
/home/<my username>/.cmodule/scapix/1.0.30/source/scapix/core/tuple.h:44:16: note: in instantiation of template class 'scapix::detail::tuple_base<std::integer_sequence<unsigned long>>' requested here
struct tuple : detail::tuple_base<std::index_sequence_for<Types...>, Types...>
               ^
/home/<my username>/.cmodule/scapix/1.0.30/source/scapix/link/java/native_method.h:105:61: note: in instantiation of template class 'scapix::tuple<>' requested here
        inline constexpr static tuple<decltype(Methods::get())...> methods = { Methods::get()... };
                                                                   ^
/<my project>/generated/bridge/java/my_class.cpp:37:22: note: in instantiation of template class 'scapix::link::java::native_methods<scapix::meta::string<'c', 'o', 'm', '/', 'e', 'x', 'a', 'm', 'p', 'l', 'e', '/', 'm', 'y', 'p', 'r', 'o', 'j', '/', 'M', 'y', 'C', 'l', 'a', 's', 's'>>' requested here
        scapix::link::java::native_methods
                            ^
/home/<my username>/.cmodule/scapix/1.0.30/source/scapix/core/tuple.h:30:12: note: previous definition is here
        constexpr tuple_base() = default;
                  ^
1 error generated.
gmake[3]: *** [src/CMakeFiles/myproj.dir/build.make:188: src/CMakeFiles/myproj.dir/__/generated/bridge/java/my_class.cpp.o] Error 1

I'm using clang 14 as a compiler. I have three classes derived from a common virtual class which is derived from scapix::bridge::object<T>. I'm trying to generate a Java interface for all of these classes. The same error appears for all three of the derived classes.

I also tried to derive all of the classes from scapix::bridge::object<T> but this didn't change anything.

TimPushkin avatar Jul 27 '22 10:07 TimPushkin

Thanks for the report.

This happens when class has no bridged functions (not even a public default constructor).

I have committed a fix.

Until new version is released, as a workaround you can add any public function to your class:

public:
    void dummy() {}

Boris-Rasin avatar Jul 27 '22 15:07 Boris-Rasin

Fix released in cmodule v1.0.36 https://www.scapix.com/language_bridge/changelog/

Boris-Rasin avatar Aug 31 '22 01:08 Boris-Rasin