Boost C++ Libraries: Ticket #6858: boost::get() calls wrongly resolved by g++ https://svn.boost.org/trac10/ticket/6858 <p> Boost 1.49.0 seems to make g++ wrongly resolve some calls to <code>boost::get()</code>. </p> <p> The attached C++ code <code>boost-get-test-ko.cc</code> does not compile properly with all the g++ compiler I used (Apple g++ 4.2, <a class="ext-link" href="http://www.macports.org"><span class="icon">​</span>MacPorts</a> g++ 4.4, 4.5, 4.6, 4.7) on my machine (2010 MacBook Pro w/ Mac OS X version 10.6.8 and Boost 1.49.0 from the MacPorts). These compilers try to use <code>boost::get()</code> from <code>boost/graph/reverse_graph.hpp</code> instead of <code>boost::get()</code> from <code>boost/variant/get.hpp</code>, leading to this kind of error messages: </p> <pre class="wiki">% g++-mp-4.7 -I/opt/local/include boost-get-test-ko.cc In file included from /opt/local/include/boost/graph/vector_as_graph.hpp:23:0, from /opt/local/include/boost/graph/transitive_closure.hpp:17, from boost-get-test-ko.cc:2: /opt/local/include/boost/graph/graph_traits.hpp: In instantiation of 'struct boost::graph_traits&lt;int&gt;': /opt/local/include/boost/graph/reverse_graph.hpp:472:1: required by substitution of 'template&lt;class Graph, class GRef&gt; typename boost::graph_traits&lt;Graph&gt;::edge_descriptor boost::get(boost::edge_underlying_t, const boost::reverse_graph&lt;BidirectionalGraph, GraphRef&gt;&amp;, const typename boost::graph_traits&lt;boost::reverse_graph&lt;BidirectionalGraph, GraphRef&gt; &gt;::edge_descriptor&amp;) [with Graph = int; GRef = &lt;missing&gt;]' boost-get-test-ko.cc:7:28: required from here /opt/local/include/boost/graph/graph_traits.hpp:30:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:31:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:32:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:33:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:34:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:35:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:36:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:38:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:39:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:40:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:42:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:43:52: error: 'int' is not a class, struct, or union type /opt/local/include/boost/graph/graph_traits.hpp:44:52: error: 'int' is not a class, struct, or union type </pre><p> If the <code>#include &lt;boost/graph/transitive_closure.hpp&gt;</code> statement is removed (see attached file <code>boost-get-test-ok.cc</code>, no compiling error arises. </p> <p> This problem looks very similar to ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4838" title="#4838: Bugs: [variant][property_map] conflicting 'boost::get&lt;&gt;'s defined in ... (closed: worksforme)">#4838</a>. </p> <p> I have obtained similar results with SVN Boost on this platform as well as on Debian GNU/Linux 6.0.4 on x86-64 with g++ 4.4. </p> <p> The versions of clang++ I tried (MacPorts clang++ 2.9, 3.0 and 3.1 on Mac OS X version 10.6 and clang 3.0 on Debian GNU/Linux 6.0.4) have no trouble compiling both files. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6858 Trac 1.4.3 Roland Levillain <roland@…> Thu, 03 May 2012 15:30:18 GMT attachment set https://svn.boost.org/trac10/ticket/6858 https://svn.boost.org/trac10/ticket/6858 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-get-test-ko.cc</span> </li> </ul> Ticket Roland Levillain <roland@…> Thu, 03 May 2012 15:30:42 GMT attachment set https://svn.boost.org/trac10/ticket/6858 https://svn.boost.org/trac10/ticket/6858 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-get-test-ok.cc</span> </li> </ul> Ticket Jeremiah Willcock Thu, 03 May 2012 16:21:01 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6858#comment:1 https://svn.boost.org/trac10/ticket/6858#comment:1 <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> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/78315" title="Edited reverse_graph to fix test case; fixes #6858">[78315]</a>) Edited reverse_graph to fix test case; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6858" title="#6858: Bugs: boost::get() calls wrongly resolved by g++ (closed: fixed)">#6858</a> </p> Ticket Jeremiah Willcock Thu, 03 May 2012 16:24:17 GMT <link>https://svn.boost.org/trac10/ticket/6858#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6858#comment:2</guid> <description> <p> I've changed <code>reverse_graph</code> to use <code>enable_if</code> to work around this problem; that might break compilers with weak SFINAE support, however. </p> </description> <category>Ticket</category> </item> <item> <author>Roland Levillain <roland@…></author> <pubDate>Fri, 04 May 2012 13:28:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6858#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6858#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/6858#comment:2" title="Comment 2">jewillco</a>: </p> <blockquote class="citation"> <p> I've changed <code>reverse_graph</code> to use <code>enable_if</code> to work around this problem; that might break compilers with weak SFINAE support, however. </p> </blockquote> <p> Thanks! </p> </description> <category>Ticket</category> </item> </channel> </rss>