Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2005-01-26 13:34:12


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net