Skip to content

Compiler error in type_conversion.hpp #129

@eschnett

Description

@eschnett

I am using libcxxwrap-julia 0.9.7.

I encounter this error:

In file included from /usr/local/include/jlcxx/array.hpp:4:
/usr/local/include/jlcxx/type_conversion.hpp:646:100: error: cannot initialize a member subobject of type 'const void *' with an lvalue of type 'std::vector<openPMD::Datatype> (*)()'
  struct boxed_void_ptr { const void* ptr; } *presult = (struct boxed_void_ptr*)result, vresult = {cpp_ptr};
                                                                                                   ^~~~~~~
/usr/local/include/jlcxx/type_conversion.hpp:823:13: note: in instantiation of function template specialization 'jlcxx::boxed_cpp_pointer<std::vector<openPMD::Datatype> ()>' requested here
    return {boxed_cpp_pointer(&cppval, julia_type<CppT&>(), false).value};
            ^
/usr/local/include/jlcxx/type_conversion.hpp:838:10: note: in instantiation of member function 'jlcxx::BoxValue<std::vector<openPMD::Datatype> (&)(), jlcxx::WrappedCppPtr>::operator()' requested here
  return BoxValue<CppT, static_julia_type<CppT>>()(std::forward<ArgT>(cppval));
         ^
/Users/runner/work/openPMD-api/openPMD-api/src/binding/julia/Datatype.cpp:31:9: note: in instantiation of function template specialization 'jlcxx::Module::set_const<std::vector<openPMD::Datatype> (&)()>' requested here
    mod.set_const("openPMD_datatypes", openPMD_Datatypes);
        ^
1 error generated.

See here for the Github CI run that reports this error.

The compilers used are

-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Julia executable: /usr/local/bin/julia
-- Julia_VERSION_STRING: 1.9.2
-- Julia_INCLUDE_DIRS:   /Applications/Julia-1.9.app/Contents/Resources/julia/include/julia
-- Julia_LIBRARY_DIR:    /Applications/Julia-1.9.app/Contents/Resources/julia/lib
-- Julia_LIBRARY:        /Applications/Julia-1.9.app/Contents/Resources/julia/lib/libjulia.1.9.dylib
-- JULIA_HOME:           /Applications/Julia-1.9.app/Contents/Resources/julia/bin
-- Julia_LLVM_VERSION:   v14.0.6
-- Julia_WORD_SIZE:      64
-- Found Julia: /Applications/Julia-1.9.app/Contents/Resources/julia/lib/libjulia.1.9.dylib (found version "1.9.2") 
-- JlCxx version: v0.9.7
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success

Would an explicit cast to const void * solve the problem?

The same code compilers without errors on other (i.e. Linux) architectures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions