Boost 1.63 karma problem converting a char vector to string

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Boost 1.63 karma problem converting a char vector to string

braden
The version of Boost.Spirit.Karma included with Boost 1.63.0 appears to have a problem converting a char vector to a string when building with Apple Clang 8.0 using the -std=c++14 (or -std=gnu++14) option. Consider the following example:

  #include <boost/spirit/include/karma.hpp>
  #include <boost/fusion/include/adapt_struct.hpp>

  struct foo {
    std::string a, b;
  };

  BOOST_FUSION_ADAPT_STRUCT(
    foo,
    (std::string, a)
    (std::string, b)
  )

  int main()
  {
    using namespace boost::spirit::karma;

    typedef rule<std::back_insert_iterator<std::string>, foo(), space_type>
      rule_t;

    rule_t r
      =   +char_ << '(' << string << ')'
      |   skip[string] << string
      ;

    foo f = {"a", "b"};
    std::string s;
    generate_delimited(std::back_inserter(s), r, space, f);
  }

When compiled with the -std=c++14 and -stdlib=libc++ options, the following error is emitted:

  boost/fusion/container/vector/vector.hpp:168:19: error:
      no matching constructor for initialization of 'std::__1::vector<char,
      std::__1::allocator<char> >'
                : elem(std::forward<U>(rhs))
                  ^    ~~~~~~~~~~~~~~~~~~~~

(along with a stack of several others, of course, which I've omitted for brevity)

The problem construct appears to be "+char_". The error goes away if it is replaced with "string"; but the error also goes away if the alternative is removed from the rule.

This code worked fine with the Boost.Spirit.Karma included with Boost 1.62.0. Can anyone suggest a workaround that would make -std=c++14 usable?

Braden
Braden McDaniel
braden@endoframe.com
Reply | Threaded
Open this post in threaded view
|

Re: Boost 1.63 karma problem converting a char vector to string

braden
braden wrote
The version of Boost.Spirit.Karma included with Boost 1.63.0 appears to have a problem converting a char vector to a string when building with Apple Clang 8.0 using the -std=c++14 (or -std=gnu++14) option.
I've created a bug report for this issue here: https://svn.boost.org/trac/boost/ticket/12732

Braden
Braden McDaniel
braden@endoframe.com