Opened 6 years ago
Closed 4 years ago
#12427 closed Bugs (fixed)
Boost Spirit: call of 'swap' is ambiguous
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | spirit |
Version: | Boost 1.58.0 | Severity: | Problem |
Keywords: | Cc: |
Description
I tried to compile a code with boost 1.58 and received the error below. The same code compiles with boost 1.55.
Error: /usr/include/boost/spirit/home/support/attributes.hpp:1036:13: error: call of overloaded ‘swap(boost::fusion::vector3<boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar> >&, boost::fusion::vector3<boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar> >&)’ is ambiguous
swap(a, b);
/usr/include/boost/core/swap.hpp:54:8: note: candidate: void boost::swap(T1&, T2&) [with T1 = boost::fusion::vector3<boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar> >; T2 = boost::fusion::vector3<boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar> >]
void swap(T1& left, T2& right)
/usr/include/boost/fusion/sequence/intrinsic/swap.hpp:57:5: note: candidate: typename boost::fusion::result_of::swap<Seq1, Seq2>::type boost::fusion::swap(Seq1&, Seq2&) [with Seq1 = boost::fusion::vector3<boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar> >; Seq2 = boost::fusion::vector3<boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar>, boost::shared_ptr<insight::cad::Scalar> >; typename boost::fusion::result_of::swap<Seq1, Seq2>::type = void]
swap(Seq1& lhs, Seq2& rhs)
Attachments (1)
Change History (8)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
I managed to reduce my code into a demonstration minimum. You can find it in the attached file "test.cpp".
Compiling it on Ubuntu Xenial via
$ g++ test.cpp
fails with the described error.
comment:4 by , 6 years ago
One plausible solution here is to use boost::swap and have fusion provide an overload for it.
comment:5 by , 6 years ago
I could compile the minimum example after inserting
namespace boost { namespace fusion { void swap(MyList&a1, MyList&a2) { boost:swap(a1, a2); } } }
comment:7 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Since there is no reaction, I suppose that my given information is a little sparse?
I investigated a bit:
The definition of "boost::fusion::swap" arises due to the inclusion of "/usr/include/boost/spirit/include/qi.hpp"
The definition of "boost::swap" comes via "/usr/include/boost/assign/list_of.hpp" Unfortunately, I need the "list_of" header in many places.
I have removed all "using namespace" statements. Unfortunately without success.