-
assigned issue to
Can't build GTSAM with Boost 1.56 with C++11
Errors about binding optional lvalue references:
C:\local\boost_1_56_0\boost/optional/optional.hpp(188): error C2338: binding rvalue references to optional lvalue references is disallowed (..\..\gtsam\symbolic\SymbolicFactorGraph.cpp)
3> C:\local\boost_1_56_0\boost/optional/optional.hpp(777) : see reference to function template instantiation 'void boost::optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref<T,gtsam::Ordering&&>(void)' being compiled
3> with
3> [
3> T=const gtsam::Ordering &
3> ]
3> C:\local\boost_1_56_0\boost/optional/optional.hpp(776) : while compiling class template member function 'boost::optional<T>::optional(gtsam::Ordering &&)'
3> with
3> [
3> T=const gtsam::Ordering &
3> ]
3> C:\Users\Chris\git\gtsam\gtsam/inference/EliminateableFactorGraph-inst.h(56) : see reference to function template instantiation 'boost::optional<T>::optional(gtsam::Ordering &&)' being compiled
3> with
3> [
3> T=const gtsam::Ordering &
3> ]
3> C:\Users\Chris\git\gtsam\gtsam/inference/EliminateableFactorGraph-inst.h(32) : see reference to class template instantiation 'boost::optional<T>' being compiled
3> with
3> [
3> T=const gtsam::Ordering &
3> ]
3> C:\Users\Chris\git\gtsam\gtsam/inference/EliminateableFactorGraph-inst.h(32) : while compiling class template member function 'boost::shared_ptr<T> gtsam::EliminateableFactorGraph<FACTORGRAPH>::eliminateSequential(gtsam::EliminateableFactorGraph<FACTORGRAPH>::OptionalOrdering,const boost::function<Signature> &,gtsam::EliminateableFactorGraph<FACTORGRAPH>::OptionalVariableIndex) const'
3> with
3> [
3> T=gtsam::SymbolicBayesNet,
3> FACTORGRAPH=gtsam::SymbolicFactorGraph,
3> Signature=std::pair<boost::shared_ptr<gtsam::SymbolicConditional>,boost::shared_ptr<gtsam::SymbolicFactor::This>> (const gtsam::SymbolicFactorGraph &,const gtsam::Ordering &)
3> ]
3> C:\Users\Chris\git\gtsam\gtsam/symbolic/SymbolicFactorGraph.h(58) : see reference to class template instantiation 'gtsam::EliminateableFactorGraph<FACTORGRAPH>' being compiled
3> with
3> [
3> FACTORGRAPH=gtsam::SymbolicFactorGraph
3> ]
Comments (12)
-
-
Also on VS2013
-
This is a boost assertion being thrown due to the following
"Rvalue references and lvalue references to const have the ability in C++ to extend the life time of a temporary they bind to. Optional references do not have this capability, therefore to avoid surprising effects it is not possible to initialize an optional references from a temporary. Optional rvalue references are disabled altogether. Also, the initialization and assignment of an optional reference to const from rvalue reference is disabled."
-
@cbeall3 Can you try compiling this with a C++11 compiler on a non-MS compiler to reproduce? This seems to be a boost issue, regardless of the compiler.
-
- marked as major
-
- changed title to Can't build GTSAM with Boost 1.56 with C++11
-
Without a major re-write, there is no real way to get around this issue. I'm adding a check in cmake to define the variable
BOOST_OPTIONAL_ALLOW_BINDING_TO_RVALUES
in the preprocessor to disable the boost assertion. Unit tests pass with the definition, but I think support for 1.56 should be given cautiously for now.
-
- changed status to on hold
-
@cbeall3 is this still an issue?
-
reporter Yes, we still have this workaround. With Boost 1.59 the flag to disable is BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES
From http://www.boost.org/doc/libs/1_59_0/boost/optional/optional.hpp
template <class To, class From> void prevent_binding_rvalue_ref_to_optional_lvalue_ref() { #ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES BOOST_STATIC_ASSERT_MSG( !boost::is_lvalue_reference<To>::value || !boost::is_rvalue_reference<From>::value, "binding rvalue references to optional lvalue references is disallowed"); #endif }
-
But, does that not mean this issue can be closed?
-
reporter - changed status to resolved
- Log in to comment