Boost 1.63 karma problem converting a char vector to string

braden <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
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&lt;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&lt;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




--
View this message in context: http://boost.2283326.n4.nabble.com/Boost-1-63-karma-problem-converting-a-char-vector-to-string-tp4690871.html
Sent from the spirit-general mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.