[Boost-bugs] [Boost C++ Libraries] #6785: read_json does not compile on GCC 4.7.0 with std=c++11

Subject: [Boost-bugs] [Boost C++ Libraries] #6785: read_json does not compile on GCC 4.7.0 with std=c++11
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-04-12 21:17:57


#6785: read_json does not compile on GCC 4.7.0 with std=c++11
-------------------------------------------------------+--------------------
 Reporter: Wojciech Cierpucha <cierpuchaw@…> | Owner: cornedbee
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: property_tree
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: ptree read_json |
-------------------------------------------------------+--------------------
 Just as the summary says it is impossible to use read_json(...) from
 Boost.PropertyTree with GCC 4.7.0 with std=c++11.

 The error is in json_parser_read.hpp:105 -
 context<PTree>::a_literal_val::operator():

 {{{
 c.stack.back()->push_back(std::make_pair(c.name, Str(b, e)));
 }}}

 Error message:
 {{{
 /usr/include/boost/property_tree/detail/json_parser_read.hpp:105:17:
 error: no matching function for call to
 â€˜boost::property_tree::basic_ptree<std::basic_string<char>,
 std::basic_string<char> >::push_back(std::pair<std::basic_string<char>,
 std::basic_string<char> >)’
 /usr/include/boost/property_tree/detail/json_parser_read.hpp:105:17: note:
 candidate is:
 In file included from /usr/include/boost/property_tree/ptree.hpp:516:0,
                  from main.cpp:4:
 /usr/include/boost/property_tree/detail/ptree_implementation.hpp:362:9:
 note: boost::property_tree::basic_ptree<Key, Data, KeyCompare>::iterator
 boost::property_tree::basic_ptree<Key, Data, KeyCompare>::push_back(const
 value_type&) [with Key = std::basic_string<char>; Data =
 std::basic_string<char>; KeyCompare = std::less<std::basic_string<char> >;
 boost::property_tree::basic_ptree<Key, Data, KeyCompare>::value_type =
 std::pair<const std::basic_string<char>,
 boost::property_tree::basic_ptree<std::basic_string<char>,
 std::basic_string<char> > >]
 /usr/include/boost/property_tree/detail/ptree_implementation.hpp:362:9:
 note: no known conversion for argument 1 from
 â€˜std::pair<std::basic_string<char>, std::basic_string<char> >’ to ‘const
 value_type& {aka const std::pair<const std::basic_string<char>,
 boost::property_tree::basic_ptree<std::basic_string<char>,
 std::basic_string<char> > >&}’
 }}}

 It compiles successfully on 4.7.0 with -std=c++98 and on both 4.6.3 and
 4.5.3 in both c++98 and c++0x modes.

 It seems strange to me that it compiles at all in c++98 mode and with an
 older gcc version, since (according to docs) ptree::push_back wants a
 pair<string, ptree>. In quoted line of code it gets a pair<string, string>
 and ptree(string) constructor is declared explicit. I have no idea why it
 was permitted without an explicit conversion before.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6785>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC