id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 12732,Karma problem converting a char vector to string,Braden McDaniel ,Joel de Guzman,"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: {{{#!c++ #include #include 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, 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 errors are emitted: {{{ $ c++ -I ~/Build/ng-core-Debug/API/inc -std=c++14 -stdlib=libc++ -o karma-char-seq karma-char-seq.cpp In file included from karma-char-seq.cpp:1: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/phoenix.hpp:11: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/phoenix/phoenix.hpp:11: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/phoenix/core.hpp:13: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/phoenix/core/debug.hpp:17: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/proto/proto.hpp:12: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/proto/core.hpp:21: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/proto/fusion.hpp:22: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/include/intrinsic.hpp:11: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/sequence/intrinsic.hpp:23: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/sequence/intrinsic/swap.hpp:15: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/view/zip_view.hpp:12: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/view/zip_view/zip_view.hpp:16: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/view/zip_view/detail/begin_impl.hpp:14: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/algorithm/transformation/transform.hpp:11: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/view/transform_view/transform_view.hpp:22: In file included from /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/container/vector/vector10.hpp:25: /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/container/vector/vector.hpp:168:19: error: no matching constructor for initialization of 'std::__1::vector >' : elem(std::forward(rhs)) ^ ~~~~~~~~~~~~~~~~~~~~ /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/container/vector/vector.hpp:208:19: note: in instantiation of function template specialization 'boost::fusion::vector_detail::store<0, std::__1::vector > >::store &, void>' requested here : store(forward_at_c(std::forward(rhs)))... ^ /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/fusion/container/vector/vector.hpp:319:15: note: in instantiation of function template specialization 'boost::fusion::vector_detail::vector_data, std::__1::vector >, std::__1::basic_string >::vector_data' requested here : base(vector_detail::each_elem(), std::forward(seq)) ^ /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/type_traits/is_convertible.hpp:482:56: note: in instantiation of function template specialization 'boost::fusion::vector >, std::__1::basic_string >::vector' requested here struct is_convertible : public integral_constant >, std::__1::basic_string > >' requested here : is_convertible ^ /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/mpl/aux_/nested_type_wknd.hpp:27:7: note: in instantiation of template class 'boost::spirit::traits::detail::attribute_is_compatible >, std::__1::basic_string >, foo>' requested here : T::type ^ /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/mpl/aux_/preprocessed/gcc/or.hpp:51:11: note: (skipping 12 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all) BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value ^ /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/mpl/aux_/nested_type_wknd.hpp:38:24: note: expanded from macro 'BOOST_MPL_AUX_NESTED_TYPE_WKND' ::boost::mpl::aux::nested_type_wknd \ ^ /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/function/function_template.hpp:1072:5: note: in instantiation of function template specialization 'boost::function3 >, mpl_::int_<15>, boost::spirit::unused_type> &, boost::spirit::context, boost::fusion::vector<> > &, const boost::spirit::karma::any_space &>::function3 >, boost::fusion::cons, boost::fusion::cons, boost::fusion::cons, boost::fusion::nil_> > > > >, boost::fusion::cons, false>, boost::fusion::cons, boost::fusion::nil_> > >, boost::fusion::nil_> > >, mpl_::bool_ > >' requested here base_type(f) ^ /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/function/function_template.hpp:1125:5: note: in instantiation of function template specialization 'boost::function >, mpl_::int_<15>, boost::spirit::unused_type> &, boost::spirit::context, boost::fusion::vector<> > &, const boost::spirit::karma::any_space &)>::function >, boost::fusion::cons, boost::fusion::cons, boost::fusion::cons, boost::fusion::nil_> > > > >, boost::fusion::cons, false>, boost::fusion::cons, boost::fusion::nil_> > >, boost::fusion::nil_> > >, mpl_::bool_ > >' requested here self_type(f).swap(*this); ^ /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/spirit/home/karma/nonterminal/rule.hpp:192:19: note: in instantiation of function template specialization 'boost::function >, mpl_::int_<15>, boost::spirit::unused_type> &, boost::spirit::context, boost::fusion::vector<> > &, const boost::spirit::karma::any_space &)>::operator= >, boost::fusion::cons, boost::fusion::cons, boost::fusion::cons, boost::fusion::nil_> > > > >, boost::fusion::cons, false>, boost::fusion::cons, boost::fusion::nil_> > >, boost::fusion::nil_> > >, mpl_::bool_ > >' requested here lhs.f = detail::bind_generator( ^ /Users/mcdanb/Build/ng-core-Debug/API/inc/boost/spirit/home/karma/nonterminal/rule.hpp:201:13: note: in instantiation of function template specialization 'boost::spirit::karma::rule >, foo (), boost::proto::exprns_::expr >, 0>, boost::spirit::unused_type, boost::spirit::unused_type>::define, boost::proto::exprns_::expr > &>, 1> &, boost::proto::exprns_::expr, 0> >, 2> &, const boost::spirit::terminal > &>, 2> &, boost::proto::exprns_::expr, 0> >, 2> &, const boost::proto::exprns_::expr &, const boost::spirit::terminal > &>, 2> &, const boost::spirit::terminal > &>, 2> &>, 2> >' requested here define(*this, expr, traits::matches >, foo (), boost::proto::exprns_::expr >, 0>, boost::spirit::unused_type, boost::spirit::unused_type>::rule > &>, 1> &, boost::proto::exprns_::expr, 0> >, 2> &, const boost::spirit::terminal > &>, 2> &, boost::proto::exprns_::expr, 0> >, 2> &, const boost::proto::exprns_::expr &, const boost::spirit::terminal > &>, 2> &, const boost::spirit::terminal > &>, 2> &>, 2> >' requested here = +char_ << '(' << string << ')' ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:489:40: note: candidate constructor not viable: no known conversion from 'std::__1::basic_string' to 'const allocator_type' (aka 'const std::__1::allocator') for 1st argument _LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:501:14: note: candidate constructor not viable: no known conversion from 'std::__1::basic_string' to 'size_type' (aka 'unsigned long') for 1st argument explicit vector(size_type __n); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:537:5: note: candidate constructor not viable: no known conversion from 'std::__1::basic_string' to 'initializer_list' (aka 'initializer_list') for 1st argument vector(initializer_list __il); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:549:5: note: candidate constructor not viable: no known conversion from 'std::__1::basic_string' to 'const std::__1::vector >' for 1st argument vector(const vector& __x); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:555:5: note: candidate constructor not viable: no known conversion from 'std::__1::basic_string' to 'std::__1::vector >' for 1st argument vector(vector&& __x) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:508:9: note: candidate constructor template not viable: requires 2 arguments, but 1 was provided vector(_InputIterator __first, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:516:9: note: candidate constructor template not viable: requires at least 3 arguments, but 1 was provided vector(_InputIterator __first, _InputIterator __last, const allo... ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:523:9: note: candidate constructor template not viable: requires 2 arguments, but 1 was provided vector(_ForwardIterator __first, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:530:9: note: candidate constructor template not viable: requires at least 3 arguments, but 1 was provided vector(_ForwardIterator __first, _ForwardIterator __last, const ... ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:483:5: note: candidate constructor not viable: requires 0 arguments, but 1 was provided vector() _NOEXCEPT_(is_nothrow_default_constructible::value) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:503:14: note: candidate constructor not viable: requires 2 arguments, but 1 was provided explicit vector(size_type __n, const allocator_type& __a); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:505:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided vector(size_type __n, const_reference __x); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:539:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided vector(initializer_list __il, const allocator_type& __a); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:550:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided vector(const vector& __x, const allocator_type& __a); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:562:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided vector(vector&& __x, const allocator_type& __a); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:506:5: note: candidate constructor not viable: requires 3 arguments, but 1 was provided vector(size_type __n, const_reference __x, const allocator_type& __a); ^ 1 error generated. }}} 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.",Bugs,new,To Be Determined,fusion,Boost 1.64.0,Regression,,,