Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: compilation fails for unsigned integer types in containers #12

Closed
eserg opened this issue May 22, 2020 · 3 comments
Closed

Bug: compilation fails for unsigned integer types in containers #12

eserg opened this issue May 22, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@eserg
Copy link

eserg commented May 22, 2020

Using tiny_bridge example add a function returning a container of uint8_ts (or any other uint type):

#include <string>
#include <scapix/bridge/object.h>

#include <vector>

namespace tiny {

class contact : public scapix::bridge::object<contact>
{
public:
   std::vector<std::uint8_t> testUInt8Vec() const { return {0, 1, 2}; } // ADDED

   std::string name() { return "Hello from C++"; }
};

} // namespace tiny

Compile with:

cmake -B build/xcode_mac_objc -G "Xcode" -DSCAPIX_BRIDGE=objc -DSCAPIX_PLATFORM=apple
cmake --build build/xcode_mac_objc

The build fails:

In file included from ~/src/scapix-uint-bug/generated/bridge/objc/bridge/bridge/Contact.mm:4:
In file included from ~/.cmodule/scapix/1.0.11/source/../../../../src/scapix-uint-bug/contact.h:2:
In file included from ~/.cmodule/scapix/1.0.11/source/scapix/bridge/object.h:11:
In file included from ~/.cmodule/scapix/1.0.11/source/scapix/bridge/objc/object.h:91:
~/.cmodule/scapix/1.0.11/source/scapix/link/objc/convert.h:32:12: error: implicit instantiation of undefined template 'scapix::link::objc::convert<NSNumber *, unsigned char, void>'
    return convert<remove_cvref_t<ObjC>, remove_cvref_t<Cpp>>::objc(std::forward<Cpp>(cpp));
           ^
~/.cmodule/scapix/1.0.11/source/scapix/link/objc/convert.h:258:29: note: in instantiation of function template specialization 'scapix::link::objc::convert_objc<NSNumber *, const unsigned char &>' requested here
            [arr addObject: convert_objc<objc_value>(element)];
                            ^
~/.cmodule/scapix/1.0.11/source/scapix/link/objc/convert.h:32:64: note: in instantiation of member function 'scapix::link::objc::convert<NSArray<NSNumber *> *, std::__1::vector<unsigned char,
      std::__1::allocator<unsigned char> >, void>::objc' requested here
    return convert<remove_cvref_t<ObjC>, remove_cvref_t<Cpp>>::objc(std::forward<Cpp>(cpp));
                                                               ^
In file included from ~/src/scapix-uint-bug/generated/bridge/objc/bridge/bridge/Contact.mm:4:
In file included from ~/.cmodule/scapix/1.0.11/source/../../../../src/scapix-uint-bug/contact.h:2:
In file included from ~/.cmodule/scapix/1.0.11/source/scapix/bridge/object.h:11:
~/.cmodule/scapix/1.0.11/source/scapix/bridge/objc/object.h:212:38: note: in instantiation of function template specialization 'scapix::bridge::objc::call_impl<&tiny::contact::testUInt8Vec>::call<NSArray<NSNumber *>
      *, Contact>' requested here
    return call_impl<Func>::template call<ObjcRet>(args...);
                                     ^
In file included from ~/src/scapix-uint-bug/generated/bridge/objc/bridge/bridge/Contact.mm:4:
In file included from ~/.cmodule/scapix/1.0.11/source/../../../../src/scapix-uint-bug/contact.h:2:
In file included from ~/.cmodule/scapix/1.0.11/source/scapix/bridge/object.h:11:
In file included from ~/.cmodule/scapix/1.0.11/source/scapix/bridge/objc/object.h:91:
~/.cmodule/scapix/1.0.11/source/scapix/link/objc/convert.h:27:8: note: template is declared here
struct convert;
       ^
1 warning and 1 error generated.

** BUILD FAILED **


The following build commands failed:
	CompileC build/xcode_mac_objc/tiny_bridge.build/Debug/bridge.build/Objects-normal/x86_64/Contact.o generated/bridge/objc/bridge/bridge/Contact.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
@Boris-Rasin
Copy link
Member

Thank you for bug report.
I have already fixes this issue and will release an updated version soon.

@Boris-Rasin
Copy link
Member

I've released new version, please update CModule release in your project CMake file and try again.

@Boris-Rasin Boris-Rasin added the bug Something isn't working label May 25, 2020
@eserg
Copy link
Author

eserg commented May 27, 2020

Thanks, it works now!

@eserg eserg closed this as completed May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants