Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#11572 closed Bugs (fixed)

The generic fusion sequence convert to a deque fails with a compiler error

Reported by: Edward Diener Owned by: Joel de Guzman
Milestone: Boost 1.60.0 Component: fusion
Version: Boost Release Branch Severity: Problem
Keywords: Cc:

Description (last modified by Edward Diener)

The following code, as deque_convert.cpp, which uses the generic boost::fusion::convert to convert to a boost::fusion::deque, fails with a compiler error:

#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/include/deque.hpp>
#include <boost/fusion/include/make_deque.hpp>
#include <boost/fusion/include/make_vector.hpp>
#include <boost/fusion/sequence/intrinsic/at_c.hpp>
#include <boost/fusion/sequence/convert.hpp>
#include <string>

int main()
{
boost::fusion::deque<int, std::string> t = boost::fusion::convert<boost::fusion::deque_tag>(boost::fusion::make_vector(123, "Hola!!!")); // Line 13
//    boost::fusion::deque<int, std::string> t =   boost::fusion::convert<boost::fusion::deque_tag>(boost::fusion::make_deque(123, "Hola!!!")); // Line 14
BOOST_TEST(boost::fusion::at_c<0>(t) == 123);
BOOST_TEST(boost::fusion::at_c<1>(t) == "Hola!!!");
return boost::report_errors();
}

Compiling with mingw-64/gcc-5.1 on Windows:

    "C:/Utilities/mingw-w64/i686-5.1.0-posix-dwarf-rt_v4-rev0/mingw32/bin/g++"  -ftemplate-depth-128 -Wno-unused-local-typedefs -ftrack-macro-expansion=0 -O0 -fno-inline -Wall -g -march=i686 -m32  -DBOOST_ALL_NO_LIB=1  -I"..\..\.." -c -o "..\..\..\bin.v2\libs\fusion\test\deque_convert.test\gcc-mingw-5.1\debug\sequence\deque_convert.o" "sequence\deque_convert.cpp"

In file included from ..\..\../boost/fusion/container/deque/convert.hpp:12:0,
                 from ..\..\../boost/fusion/container/deque.hpp:14,
                 from ..\..\../boost/fusion/include/deque.hpp:11,
                 from sequence\deque_convert.cpp:2:
..\..\../boost/fusion/container/deque/detail/convert_impl.hpp: In instantiation of 'static boost::fusion::extension::convert_impl<boost::fusion::deque_tag>::apply<Sequence>::type boost::fusion::extension::convert_impl<boost::fusion::deque_tag>::apply<Sequence>::call(Sequence&) [with Sequence = const boost::fusion::vector2<int, const char (&)[8]>; boost::fusion::extension::convert_impl<boost::fusion::deque_tag>::apply<Sequence>::type = boost::fusion::deque<int, const char (&)[8], boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>]':
..\..\../boost/fusion/sequence/convert.hpp:48:25:   required from 'typename boost::fusion::result_of::convert<Tag, const Sequence>::type boost::fusion::convert(const Sequence&) [with Tag = boost::fusion::deque_tag; Sequence = boost::fusion::vector2<int, const char (&)[8]>; typename boost::fusion::result_of::convert<Tag, const Sequence>::type = boost::fusion::deque<int, const char (&)[8], boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>]'
sequence\deque_convert.cpp:11:139:   required from here
..\..\../boost/fusion/container/deque/detail/convert_impl.hpp:44:37: error: 'call' is not a member of 'boost::fusion::extension::convert_impl<boost::fusion::deque_tag>::apply<const boost::fusion::vector2<int, const char (&)[8]> >::gen {aka boost::fusion::result_of::as_deque<const boost::fusion::vector2<int, const char (&)[8]> >}'
                     return gen::call(seq);

Compiling with msvc-14.0 on Windows:

file ..\..\..\bin.v2\libs\fusion\test\deque_convert.test\msvc-14.0\debug\threading-multi\sequence\deque_convert.obj.rsp
"sequence\deque_convert.cpp" -Fo"..\..\..\bin.v2\libs\fusion\test\deque_convert.test\msvc-14.0\debug\threading-multi\sequence\deque_convert.obj"    -TP /Z7 /Od /Ob0 /W3 /GR /MDd /Zc:forScope /Zc:wchar_t /wd4675 /EHs -c 
-DBOOST_ALL_NO_LIB=1 
"-I..\..\.."
compile-c-c++ ..\..\..\bin.v2\libs\fusion\test\deque_convert.test\msvc-14.0\debug\threading-multi\sequence\deque_convert.obj

    call "C:\Users\eldiener\AppData\Local\Temp\b2_msvc_14.0_vcvarsall_x86.cmd" >nul
cl /Zm800 -nologo @"..\..\..\bin.v2\libs\fusion\test\deque_convert.test\msvc-14.0\debug\threading-multi\sequence\deque_convert.obj.rsp" 

deque_convert.cpp
Unknown compiler version - please run the configure tests and report the results
C:\Programming\VersionControl\modular-boost\boost/fusion/container/deque/detail/convert_impl.hpp(44): error C2039: 'call': is not a member of 'boost::fusion::result_of::as_deque<Sequence>'
        with
        [
            Sequence=const boost::fusion::vector2<int,const char (&)[8]>
        ]
C:\Programming\VersionControl\modular-boost\boost/fusion/container/deque/detail/convert_impl.hpp(43): note: while compiling class template member function 'boost::fusion::deque<int,const char (&)[8],boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_> boost::fusion::extension::convert_impl<boost::fusion::deque_tag>::apply<Sequence>::call(Sequence &)'
        with
        [
            Sequence=const boost::fusion::vector2<int,const char (&)[8]>
        ]
C:\Programming\VersionControl\modular-boost\boost/fusion/sequence/convert.hpp(48): note: see reference to function template instantiation 'boost::fusion::deque<int,const char (&)[8],boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_> boost::fusion::extension::convert_impl<boost::fusion::deque_tag>::apply<Sequence>::call(Sequence &)' being compiled
        with
        [
            Sequence=const boost::fusion::vector2<int,const char (&)[8]>
        ]
C:\Programming\VersionControl\modular-boost\boost/fusion/sequence/convert.hpp(29): note: see reference to class template instantiation 'boost::fusion::extension::convert_impl<boost::fusion::deque_tag>::apply<Sequence>' being compiled
        with
        [
            Sequence=const boost::fusion::vector2<int,const char (&)[8]>
        ]
sequence\deque_convert.cpp(11): note: see reference to class template instantiation 'boost::fusion::result_of::convert<boost::fusion::deque_tag,const boost::fusion::vector2<T,const char (&)[8]>>' being compiled
        with
        [
            T=int
        ]

Compiling with clang-3.8:

  "C:/Programming/VersionControl/bninja_installed_clang/bin/clang++" -c -x c++ -D__MINGW_FORCE_SYS_INTRINS -Wno-unused-local-typedef -Wno-dll-attribute-on-redeclaration -O0 -g -fno-inline -Wall -g -march=i686 -m32  -DBOOST_ALL_NO_LIB=1 -I"..\..\.." -o "..\..\..\bin.v2\libs\fusion\test\deque_convert.test\clang-linux-3.8\debug\sequence\deque_convert.obj" "sequence\deque_convert.cpp"

In file included from sequence\deque_convert.cpp:2:
In file included from ..\..\..\boost/fusion/include/deque.hpp:11:
In file included from ..\..\..\boost/fusion/container/deque.hpp:14:
In file included from ..\..\..\boost/fusion/container/deque/convert.hpp:12:
..\..\..\boost/fusion/container/deque/detail/convert_impl.hpp:44:33: error: no member named 'call' in 'boost::fusion::result_of::as_deque<const boost::fusion::vector2<int, char const (&)[8]> >'
                    return gen::call(seq);
                           ~~~~~^
..\..\..\boost/fusion/sequence/convert.hpp:48:21: note: in instantiation of member function 'boost::fusion::extension::convert_impl<boost::fusion::deque_tag>::apply<const boost::fusion::vector2<int, char const (&)[8]> >::call' requested here
        return gen::call(seq);
                    ^
sequence\deque_convert.cpp:11:63: note: in instantiation of function template specialization 'boost::fusion::convert<boost::fusion::deque_tag, boost::fusion::vector2<int, char const (&)[8]> >' requested here
    boost::fusion::deque<int, std::string> t = boost::fusion::convert<boost::fusion::deque_tag>(boost::fusion::make_vector(123, "Hola!!!")); // Line 13

In the source file commenting out line 13 and uncommenting line 14 produces the same error. I do not believe any conversion to a boost::fusion::deque, using the generic boost::fusion::convert functionality, will work.

I discovered this bug testing out a PR for the iterator library where a suggested change has been implemented so that the zip_iterator in the iterator library can use fusion sequences, and through the fusion adapter, std::tuple, as the tuple type for the tupleiterator of a zip_iterator.

Change History (4)

comment:1 by Edward Diener, 7 years ago

Description: modified (diff)

comment:2 by Kohei Takahashi <flast@…>, 7 years ago

Milestone: To Be DeterminedBoost 1.60.0

comment:3 by Joel de Guzman, 7 years ago

Resolution: fixed
Status: newclosed

comment:4 by James E. King, III, 5 years ago

Unfortunate boostorg/iterator does not have "issues" enabled so I could not report it there, but boost iterator test jamfile.v2 has a commented out line referencing this fix, and now that this is fixed, that line should be uncommented.

Note: See TracTickets for help on using tickets.