Boost C++ Libraries: Ticket #4750: is_convertible_basic_impl causes compile error when used inside OpenMP loop https://svn.boost.org/trac10/ticket/4750 <p> In the following example compile error is generated under Visual 2008, if "default(none)" is used for OpenMP variable data sharing attribute clauses (which is the recommended choice). It's practically a deal breaker when a novice user tries to use boost with OpenMP. And I would say OpenMP use will only grow. </p> <p> #define BOOST_ALL_NO_LIB 1 </p> <p> #include &lt;boost/graph/adjacency_list.hpp&gt; </p> <p> #include &lt;omp.h&gt; </p> <p> int main(int argc, char* argv[]) { </p> <blockquote> <p> typedef boost::adjacency_list&lt;boost::vecS, boost::vecS, boost::undirectedS&gt; <a class="missing wiki">GraphType</a>; </p> </blockquote> <blockquote> <p> typedef GraphType::adjacency_iterator <a class="missing wiki">GraphAdjacencyIterator</a>; </p> </blockquote> <blockquote> <p> const unsigned int vertex_count( 20 ); </p> </blockquote> <blockquote> <p> typedef std::pair&lt;int, int&gt; <a class="missing wiki">EdgeType</a>; </p> </blockquote> <blockquote> <p> std::vector&lt;<a class="missing wiki">EdgeType</a>&gt; edges; </p> </blockquote> <blockquote> <p> const <a class="missing wiki">GraphType</a> graph( edges.begin(), edges.end(), vertex_count, edges.size() ); </p> </blockquote> <blockquote> <p> int i( 0 ); </p> </blockquote> <blockquote> <p> #pragma omp parallel for schedule(static, 1) default(none) private(i) shared(vertex_count, graph) </p> </blockquote> <blockquote> <p> for ( i = 0; i &lt; vertex_count; ++i ) { </p> <blockquote> <p> const std::pair&lt;<a class="missing wiki">GraphAdjacencyIterator</a>, <a class="missing wiki">GraphAdjacencyIterator</a>&gt; adjacent ( </p> <blockquote> <p> boost::adjacent_vertices(i, graph) </p> </blockquote> <p> ); </p> </blockquote> <p> } </p> </blockquote> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> <p> "\boost\boost/type_traits/is_convertible.hpp(263) : error C3052: '_m_from' : variable doesn't appear in a data-sharing clause under a default(none) clause" </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4750 Trac 1.4.3 therealremi@… Mon, 18 Oct 2010 15:34:32 GMT <link>https://svn.boost.org/trac10/ticket/4750#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4750#comment:1</guid> <description> <p> Sory for bad formating. Again: </p> <pre class="wiki">#define BOOST_ALL_NO_LIB 1 #include &lt;boost/graph/adjacency_list.hpp&gt; #include &lt;omp.h&gt; int main(int argc, char* argv[]) { typedef boost::adjacency_list&lt;boost::vecS, boost::vecS, boost::undirectedS&gt; GraphType; typedef GraphType::adjacency_iterator GraphAdjacencyIterator; const unsigned int vertex_count( 20 ); typedef std::pair&lt;int, int&gt; EdgeType; std::vector&lt;EdgeType&gt; edges; const GraphType graph( edges.begin(), edges.end(), vertex_count, edges.size() ); int i( 0 ); #pragma omp parallel for schedule(static, 1) default(none) private(i) shared(vertex_count, graph) for ( i = 0; i &lt; vertex_count; ++i ) { const std::pair&lt;GraphAdjacencyIterator, GraphAdjacencyIterator&gt; adjacent ( boost::adjacent_vertices(i, graph) ); } return 0; } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Tue, 19 Oct 2010 09:14:06 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4750#comment:2 https://svn.boost.org/trac10/ticket/4750#comment:2 <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">wontfix</span> </li> </ul> <p> Here's the thing - I don't see that there is anything we can do at out end to fix this as private/shared attribute can only be added in the OMP declaration? </p> <p> For example adding </p> <p> <code>boost::detail::is_convertible_basic_impl&lt;boost::detail::iterator_category_with_traversal&lt;std::input_iterator_tag,boost::random_access_traversal_tag&gt; &amp;, std::input_iterator_tag&gt;::_m_from</code> </p> <p> to the shared list in your OMP declaration fixes the compile. </p> <p> Of course that then makes your code depend on an implementation detail, which it clearly shouldn't do :-( </p> <p> To be honest I don't understand why MSVC is complaining here, given that it's producing an error for something that clearly is not used as a variable in the loop, GCC compiles your code just fine BTW with g++ -omp. </p> <p> Closing for now since I can't see how we <em>can</em> fix, please reopen if there is a fix we can apply at our end. </p> Ticket