Boost C++ Libraries: Ticket #6785: read_json does not compile on GCC 4.7.0 with std=c++11 https://svn.boost.org/trac10/ticket/6785 <p> Just as the summary says it is impossible to use read_json(...) from Boost.<a class="missing wiki">PropertyTree</a> with GCC 4.7.0 with std=c++11. </p> <p> The error is in json_parser_read.hpp:105 - context&lt;PTree&gt;::a_literal_val::operator(): </p> <pre class="wiki">c.stack.back()-&gt;push_back(std::make_pair(c.name, Str(b, e))); </pre><p> Error message: </p> <pre class="wiki">/usr/include/boost/property_tree/detail/json_parser_read.hpp:105:17: error: no matching function for call to ‘boost::property_tree::basic_ptree&lt;std::basic_string&lt;char&gt;, std::basic_string&lt;char&gt; &gt;::push_back(std::pair&lt;std::basic_string&lt;char&gt;, std::basic_string&lt;char&gt; &gt;)’ /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&lt;Key, Data, KeyCompare&gt;::iterator boost::property_tree::basic_ptree&lt;Key, Data, KeyCompare&gt;::push_back(const value_type&amp;) [with Key = std::basic_string&lt;char&gt;; Data = std::basic_string&lt;char&gt;; KeyCompare = std::less&lt;std::basic_string&lt;char&gt; &gt;; boost::property_tree::basic_ptree&lt;Key, Data, KeyCompare&gt;::value_type = std::pair&lt;const std::basic_string&lt;char&gt;, boost::property_tree::basic_ptree&lt;std::basic_string&lt;char&gt;, std::basic_string&lt;char&gt; &gt; &gt;] /usr/include/boost/property_tree/detail/ptree_implementation.hpp:362:9: note: no known conversion for argument 1 from ‘std::pair&lt;std::basic_string&lt;char&gt;, std::basic_string&lt;char&gt; &gt;’ to ‘const value_type&amp; {aka const std::pair&lt;const std::basic_string&lt;char&gt;, boost::property_tree::basic_ptree&lt;std::basic_string&lt;char&gt;, std::basic_string&lt;char&gt; &gt; &gt;&amp;}’ </pre><p> 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. </p> <p> 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&lt;string, ptree&gt;. In quoted line of code it gets a pair&lt;string, string&gt; and ptree(string) constructor is declared explicit. I have no idea why it was permitted without an explicit conversion before. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6785 Trac 1.4.3 Wojciech Cierpucha <cierpuchaw@…> Thu, 12 Apr 2012 21:18:30 GMT attachment set https://svn.boost.org/trac10/ticket/6785 https://svn.boost.org/trac10/ticket/6785 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">read_json_gcc47_cpp11.cpp</span> </li> </ul> <p> Simple test case that does not compile. </p> Ticket pierre.imai@… Fri, 11 May 2012 08:05:28 GMT <link>https://svn.boost.org/trac10/ticket/6785#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6785#comment:1</guid> <description> <p> I noticed the same problem, but managed to fix it by simply replacing </p> <div class="wiki-code"><div class="code"><pre><span class="n">c</span><span class="p">.</span><span class="n">stack</span><span class="p">.</span><span class="n">back</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">push_back</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">make_pair</span><span class="p">(</span><span class="n">c</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">Str</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">e</span><span class="p">)));</span> </pre></div></div><p> with </p> <div class="wiki-code"><div class="code"><pre><span class="n">c</span><span class="p">.</span><span class="n">stack</span><span class="p">.</span><span class="n">back</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">push_back</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">make_pair</span><span class="p">(</span><span class="n">c</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">Ptree</span><span class="p">(</span><span class="n">Str</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">e</span><span class="p">))));</span> </pre></div></div> </description> <category>Ticket</category> </item> <item> <dc:creator>Sebastian Redl</dc:creator> <pubDate>Wed, 23 May 2012 12:12:00 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6785#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6785#comment:2</guid> <description> <p> Fixed on trunk as Pierre suggested. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Sebastian Redl</dc:creator> <pubDate>Sun, 27 May 2012 13:18:27 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6785#comment:3 https://svn.boost.org/trac10/ticket/6785#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed in <a class="changeset" href="https://svn.boost.org/trac10/changeset/78679" title="Merge r78550 to release. Fixes an outdated test to work again. Fixes ...">r78679</a>. </p> Ticket cbvora Sat, 30 Nov 2013 06:43:22 GMT <link>https://svn.boost.org/trac10/ticket/6785#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6785#comment:4</guid> <description> <p> where is d sol of Nox openflow controller </p> <p> installation $cd /etc/apt/sources.list.d $sudo wget </p> <p> openflowswitch.org/downloads/debian/nox.list </p> <p> (falllllll) so …at here i got fall it said “N: Ignoring file ‘nox.list.1′ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?” </p> </description> <category>Ticket</category> </item> </channel> </rss>