[patch] std::unique_ptr<T[], D> improvements
Lawrence Crowl
crowl@googlers.com
Tue Jan 1 21:36:00 GMT 2013
On 1/1/13, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 1 January 2013 20:40, Lawrence Crowl wrote:
>> That was pilot error on my part. However, I've been having trouble
>> when the argument to the constructor or reset has a conversion
>> operator. The code does distinquish between a safe conversion to
>> base and an unsafe conversion to derived.
>>
>> Here is a simplified version of the problem. The code as is fails
>> to reject the last two calls to accept. The primary reason is that
>> is_convertable permits both the invocation of the conversion operator
>> and the derived to base conversion. At present, I see no way to
>> get a handle on the 'natural' return type of the conversion operator.
>
> Is the issue here that Geoffrey's proposed resolution allows any
> conversions (safe or not) if the source type is not a built-in
> pointer, i.e. is some user-defined type? So a user-defined type that
> refers an array of derived classes is allowed to be converted to an
> array of base, even though that's not safe. Howard has strongly
> objected to this part of the P/R.
Yes. I see no way to distinguish between objects with safe conversion
operators and unsafe conversion operators.
--
Lawrence Crowl
More information about the Libstdc++
mailing list