Search code examples
c++boosticc

Fail to compile program using boost::spirit with Intel C++ compiler


I'm trying to compile the following example http://www.boost.org/doc/libs/1_60_0/libs/spirit/example/qi/compiler_tutorial/calc3.cpp using Intel C++ compiler.

Compilation fails and I get 300 kB of errors. The first few are:

boost/fusion/container/vector/vector.hpp(69): error: namespace "boost::fusion::vector_detail::result_of" has no member "value_at_c"
          : boost::is_convertible<Sequence, typename result_of::value_at_c<This, 0>::type>
                                                                ^
boost/fusion/container/vector/vector.hpp(69): error: expected a ">"
          : boost::is_convertible<Sequence, typename result_of::value_at_c<This, 0>::type>
                                                                          ^
boost/fusion/container/vector/vector.hpp(69): error: not a class or struct name
          : boost::is_convertible<Sequence, typename result_of::value_at_c<This, 0>::type>
            ^

Command line is

icl.exe /I<path-to-boost> calc3.cpp

Boost version: 1.60, compiler version: 15.0.6.285 Build 20151119

Although I was able to fix the error by changing the line 69

struct is_convertible_to_first
        : boost::is_convertible<Sequence, typename result_of::value_at_c<This, 0>::type>
    {};

to

struct is_convertible_to_first
        : boost::is_convertible<Sequence, typename boost::fusion::result_of::value_at_c<This, 0>::type>
    {};

, I'm still curious why is there a problem?


Solution

  • The most reasonable guess is that the result_of namespace that ICC finds within boost::fusion::vector_detail is only a workaround for non-conforming compilers (e.g. I think GCC 4.6 lacks some support there too) so, the name clash with boost::fusion::result_of only manifests there.

    So it's a bug reportable with the library devs; the namespace should be qualified more to accomodate old compilers. (It's possible it won't be fixed anymore if said compilers aren't supported)