boost/graph 1.32.0 : compilation errors on a SUN machine

Hello, I cannot compile the boost/graph library 1.32.0 on a SUN machine using Sun C++ 5.5. I get the following error message : boost_1_32_0/boost/graph/depth_first_search.hpp", line 377: Error: Default arguments cannot be added in later declarations of the template function in the same scope. which does make sense since the compiler cannot decide which routine depth_first_visit to use if the second routine (line 371) has an extra template but the the extra template has a default value. So in boost/graph/depth_first_search.hpp, I simply deleted the default argument : template <class IncidenceGraph, class DFSVisitor, class ColorMap, class TerminatorFunc> void depth_first_visit (const IncidenceGraph& g, typename graph_traits<IncidenceGraph>::vertex_descriptor u, DFSVisitor vis, ColorMap color, TerminatorFunc func = TerminatorFunc()) becomes template <class IncidenceGraph, class DFSVisitor, class ColorMap, class TerminatorFunc> void depth_first_visit (const IncidenceGraph& g, typename graph_traits<IncidenceGraph>::vertex_descriptor u, DFSVisitor vis, ColorMap color, TerminatorFunc func) Unfortunately the compilation was afterwards not successful; this time I got "boost_1_32_0/boost/graph/named_function_params.hpp", line 500: Error: Cannot return const boost::bgl_named_params<boost::detail::components_recorder<int*>, boost::graph_visitor_t, boost::no_property> from a function that should return boost::detail::error_property_not_found. "boost_1_32_0/boost/graph/depth_first_search.hpp", line 354: Where: While instantiating "boost::get_param<boost::graph_visitor_t, boost::root_vertex_t, boost::detail::components_recorder<int*>, boost::no_property>(const boost::bgl_named_params<boost::detail::components_recorder<int*>, boost::graph_visitor_t, boost::no_property>&, boost::root_vertex_t)". "boost_1_32_0/boost/graph/depth_first_search.hpp", line 354: Where: Instantiated from non-template code. "boost_1_32_0/boost/graph/depth_first_search.hpp", line 355: Error: Could not find a match for boost::vertices<boost::T>(const boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>). big thanks for any help, Laurent

laurent de Vito wrote:
I cannot compile the boost/graph library 1.32.0 on a SUN machine using Sun C++ 5.5. I get the following error message :
boost_1_32_0/boost/graph/depth_first_search.hpp", line 377: Error: Default arguments cannot be added in later declarations of the template function in the same scope.
which does make sense since the compiler cannot decide which routine depth_first_visit to use if the second routine (line 371) has an extra template but the the extra template has a default value.
I don't think the compiler is right. The second version should be used if - the extra function parameter is explicitly provided, or - the function is called with explicitly specified *four* template parameters In other cases, compiler won't be able to deduce template parameters for the second function, and will call the first one. I'd suggest to report a bug to Sun.
Unfortunately the compilation was afterwards not successful; this time I got
"boost_1_32_0/boost/graph/named_function_params.hpp", line 500: Error: Cannot return const boost::bgl_named_params<boost::detail::components_recorder<int*>, boost::graph_visitor_t, boost::no_property> from a function that should return boost::detail::error_property_not_found.
No idea here. The Sun compiler is not considered very standard-compliant, and guessing what is wrong here is hard. Do you pass root vertex to dfs search? If not, then the function must return error_property_not_found, and it it tries to return something else, the bug is in the 'Dispatcher' logic. - Volodya - Volodya

laurent de Vito wrote:
I cannot compile the boost/graph library 1.32.0 on a SUN machine using Sun C++ 5.5. I get the following error message :
boost_1_32_0/boost/graph/depth_first_search.hpp", line 377: Error: Default arguments cannot be added in later declarations of the template function in the same scope.
which does make sense since the compiler cannot decide which routine depth_first_visit to use if the second routine (line 371) has an extra template but the the extra template has a default value.
I don't think the compiler is right. The second version should be used if - the extra function parameter is explicitly provided, or - the function is called with explicitly specified *four* template parameters
In other cases, compiler won't be able to deduce template parameters for the second function, and will call the first one. I'd suggest to report a bug to Sun.
It is a function template and a function template gets its template argument only via function argument not as part of its name. You can not call the function with four template arguments without explicitly specifiing the default argument. IMHO it is not a compiler bug.
Unfortunately the compilation was afterwards not successful; this time I got
"boost_1_32_0/boost/graph/named_function_params.hpp", line 500: Error: Cannot return const boost::bgl_named_params<boost::detail::components_recorder<int*>, boost::graph_visitor_t, boost::no_property> from a function that should return boost::detail::error_property_not_found.
No idea here. The Sun compiler is not considered very standard-compliant, and guessing what is wrong here is hard.
Do you pass root vertex to dfs search? If not, then the function must return error_property_not_found, and it it tries to return something else, the bug is in the 'Dispatcher' logic.
My prog does nothing more than what you can find in http://www.boost.org/libs/graph/example/connected_components.cpp I simply compute the number of components. Laurent
- Volodya
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

On Jan 26, 2005, at 11:16 AM, laurent de Vito wrote:
laurent de Vito wrote:
I cannot compile the boost/graph library 1.32.0 on a SUN machine using Sun C++ 5.5. I get the following error message :
boost_1_32_0/boost/graph/depth_first_search.hpp", line 377: Error: Default arguments cannot be added in later declarations of the template function in the same scope.
which does make sense since the compiler cannot decide which routine depth_first_visit to use if the second routine (line 371) has an extra template but the the extra template has a default value.
I don't think the compiler is right. The second version should be used if - the extra function parameter is explicitly provided, or - the function is called with explicitly specified *four* template parameters
In other cases, compiler won't be able to deduce template parameters for the second function, and will call the first one. I'd suggest to report a bug to Sun.
It is a function template and a function template gets its template argument only via function argument not as part of its name. You can not call the function with four template arguments without explicitly specifiing the default argument.
This is wrong. Quoting from the C++ standard, 14.8.1/1: Template arguments can be specified when referring to a function template specialization by qualifying the function template name with the list of template-arguments in the same way as template-arguments are specified in uses of a class template specialization.
IMHO it is not a compiler bug.
It is a compiler bug. We have tried on other occasions to get the Sun C++ compiler to handle the Boost Graph Library, but have always failed. The compiler just isn't conforming enough. Doug
participants (3)
-
Doug Gregor
-
laurent de Vito
-
Vladimir Prus