Opened 12 years ago
Closed 12 years ago
#4750 closed Bugs (wontfix)
is_convertible_basic_impl causes compile error when used inside OpenMP loop
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | type_traits |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | OpenMP, type traits, graph | Cc: |
Description
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.
#define BOOST_ALL_NO_LIB 1
#include <boost/graph/adjacency_list.hpp>
#include <omp.h>
int main(int argc, char* argv[]) {
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> GraphType;
typedef GraphType::adjacency_iterator GraphAdjacencyIterator;
const unsigned int vertex_count( 20 );
typedef std::pair<int, int> EdgeType;
std::vector<EdgeType> 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 < vertex_count; ++i ) {
const std::pair<GraphAdjacencyIterator, GraphAdjacencyIterator> adjacent (
boost::adjacent_vertices(i, graph)
);
}
return 0;
}
"\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"
Change History (2)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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?
For example adding
boost::detail::is_convertible_basic_impl<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::random_access_traversal_tag> &, std::input_iterator_tag>::_m_from
to the shared list in your OMP declaration fixes the compile.
Of course that then makes your code depend on an implementation detail, which it clearly shouldn't do :-(
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.
Closing for now since I can't see how we can fix, please reopen if there is a fix we can apply at our end.
Sory for bad formating. Again: