Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-01-31 07:15:33


On Thu, 30 Jan 2003 18:43:19 +0100, Daniel Frey
<daniel.frey_at_[hidden]> wrote:

>Gennaro Prota wrote:
>>
>> to avoid changes not forced by compiler bugs. Incidentally, I noticed
>> that if you add a default argument
>>
>> template<typename T>
>> static yes check(D const volatile *, T = 0);
>> static no check(B const volatile *, int = 0);
>>
>> and write:
>>
>> sizeof(checker<B,D>::check( (C()) /*, 0*/ ))
>>
>> then ambiguity problems arise, even with Comeau 4.3.0.1. Defect in the
>> standard?
>
>What should the compiler deduce for T? Argument type deduction doesn't
>work well with default parameters.

You are right. I was too heedless when looking at the compiler output:
the word "ambiguous" was in

    `B' is an ambiguous base of `D'

while I thought it was in some message referring to the function call.
There were just too warning messages to distinguish the errors! :-)
For the records, the warnings were about choosing

   C::operator const volatile D*()
over
   C::operator const volatile B*() const

for the call of

   no check(B const volatile *, int);

> There is already a DR (IIRC) that
>would allow:
>
>template<typename T = int>
>static yes check(D const volatile *, T = 0);
>
>but I don't know if any compilers implement it yet.

Yes, it's the very same DR that requires introduction of default
template arguments for function templates:

http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#226

Thanks,
Genny.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk