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

0.9.0: error: reference to type 'const std::shared_ptr<const void>' could not bind to an rvalue of type 'const SymEngine::Basic *' #1907

Closed
yurivict opened this issue Apr 30, 2022 · 3 comments

Comments

@yurivict
Copy link

clang-13 prints this error:

In file included from /disk-samsung/freebsd-ports/math/symengine/work/symengine-0.9.0/symengine/basic.cpp:3:
/disk-samsung/freebsd-ports/math/symengine/work/symengine-0.9.0/symengine/serialize-cereal.h:288:44: error: reference to type 'const std::shared_ptr<const void>' could not bind to an rvalue of type 'const SymEngine::Basic *'
    uint32_t id = ar.registerSharedPointer(ptr.get());
                                           ^~~~~~~~~
/disk-samsung/freebsd-ports/math/symengine/work/symengine-0.9.0/symengine/serialize-cereal.h:311:5: note: in instantiation of function template specialization 'SymEngine::save_basic<cereal::PortableBinaryOutputArchive>' requested here
    save_basic(ar, rcp_static_cast<const Basic>(ptr));
    ^
/usr/local/include/cereal/cereal.hpp:532:9: note: in instantiation of function template specialization 'SymEngine::save<cereal::PortableBinaryOutputArchive, SymEngine::Basic>' requested here
        CEREAL_SAVE_FUNCTION_NAME(*self, t);
        ^
/usr/local/include/cereal/macros.hpp:92:35: note: expanded from macro 'CEREAL_SAVE_FUNCTION_NAME'
#define CEREAL_SAVE_FUNCTION_NAME save
                                  ^
/usr/local/include/cereal/cereal.hpp:444:15: note: in instantiation of function template specialization 'cereal::OutputArchive<cereal::PortableBinaryOutputArchive, 1>::processImpl<SymEngine::RCP<const SymEngine::Basic>, 0>' requested here
        self->processImpl( head );
              ^
/usr/local/include/cereal/cereal.hpp:453:15: note: in instantiation of function template specialization 'cereal::OutputArchive<cereal::PortableBinaryOutputArchive, 1>::process<SymEngine::RCP<const SymEngine::Basic>>' requested here
        self->process( std::forward<Other>( tail )... );
              ^
/usr/local/include/cereal/cereal.hpp:453:15: note: in instantiation of function template specialization 'cereal::OutputArchive<cereal::PortableBinaryOutputArchive, 1>::process<unsigned short &, SymEngine::RCP<const SymEngine::Basic>>' requested here
/usr/local/include/cereal/cereal.hpp:333:15: note: in instantiation of function template specialization 'cereal::OutputArchive<cereal::PortableBinaryOutputArchive, 1>::process<unsigned short &, unsigned short &, SymEngine::RCP<const SymEngine::Basic>>' requested here
        self->process( std::forward<Types>( args )... );
              ^
/disk-samsung/freebsd-ports/math/symengine/work/symengine-0.9.0/symengine/basic.cpp:56:45: note: in instantiation of function template specialization 'cereal::OutputArchive<cereal::PortableBinaryOutputArchive, 1>::operator()<unsigned short &, unsigned short &, SymEngine::RCP<const SymEngine::Basic>>' requested here
    cereal::PortableBinaryOutputArchive{oss}(major, minor,
                                            ^
/usr/local/include/cereal/cereal.hpp:398:85: note: passing argument to parameter 'sharedPointer' here
      inline std::uint32_t registerSharedPointer(const std::shared_ptr<const void>& sharedPointer)
                                                                                    ^
1 error generated.

FreeBSD 13

@isuruf
Copy link
Member

isuruf commented Apr 30, 2022

Which version of cereal is this?

@isuruf
Copy link
Member

isuruf commented Apr 30, 2022

v1.3.1 and upwards made a backwards incompatible change, but did not change the version macro, so we can't easily distinguish between v1.3.0 and v1.3.1 to apply a fix. This was fixed in v1.3.2.
So, use v1.3.2 or v1.3.0, but don't use v1.3.1.

See USCiLab/cereal#748
and

#if CEREAL_VERSION >= 10301
std::shared_ptr<void> sharedPtr = std::static_pointer_cast<void>(
std::make_shared<RCP<const Basic>>(ptr));
uint32_t id = ar.registerSharedPointer(sharedPtr);
#else
uint32_t id = ar.registerSharedPointer(ptr.get());
#endif

Duplicate of #1886

@yurivict
Copy link
Author

yurivict commented Apr 30, 2022

cereal was of version 1.3.1. It builds fine with cereal-1.3.2, thanks!

Please feel free to close this issue.

@isuruf isuruf closed this as completed Apr 30, 2022
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Apr 30, 2022
Reference explaining why cereal-1.3.1 is broken:
symengine/symengine#1907 (comment)

Approved by:	portmgr (blanket; unbreak)

(cherry picked from commit c5e154a)
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Apr 30, 2022
Reference explaining why cereal-1.3.1 is broken:
symengine/symengine#1907 (comment)

Approved by:	portmgr (blanket; unbreak)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants