Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-01-25 08:35:48


From: "John Maddock" <jm_at_[hidden]>
> >
> > I think that no special ban list is necessary. Given the specification
> > "Returns true if and only if an lvalue of type From is convertible to To
> > (4p3)" the implication is that is_convertible should return false when
To
> is
> > an array type, as
> >
> > typedef int T[2];
> >
> > T t(e);
>
> Yes, OK.
>
> > is not allowed for any e. A similar argument holds for To being abstract
> or
> > function type.
>
> I don't think so, a compile time error would occur if you try and
> instantiate is_convertible with a abstract, function, or incomplete type,
> since you cannot create objects of those types.

This is a limitation of the current library solution. You can fix the spec
to make the current behavior legal, _or_ you can keep the spec clean and
leave it to the implementors to get it right (or to not get it right as the
case may be.) I.e. it is up to you to decide whether this is a bug or a
feature. My opinion is that it is a bug... except that From and To must be
complete, of course, or is_convertible may violate ODR.


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