This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] std::unique_ptr<T[], D> improvements


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]