This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] std::unique_ptr<T[], D> improvements
- From: Lawrence Crowl <crowl at googlers dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Geoffrey Romer <gromer at google dot com>
- Date: Tue, 1 Jan 2013 13:35:57 -0800
- Subject: Re: [patch] std::unique_ptr<T[], D> improvements
- References: <CAH6eHdQCP8DLv35YtXr-QpMtkWUe+p6ryL0h4PwBZa2K0q+NEg@mail.gmail.com> <CAGqM8fYj0wgzjVpAE8NxX2rPJYZ4nVc7hcr0nphW8sFy0D6R7A@mail.gmail.com> <CAH6eHdRSTFr9RSEfCwzgCM1YoqD=2sX6ESkwg4rTOUX5cjJVLg@mail.gmail.com> <CAGqM8fYT6jXCGdObK=MC9W-xb2N4BhbjRj37iNYiQuyBmX+HCQ@mail.gmail.com> <CAH6eHdRGv2wNe7URFxZG+x99Zbhbffsx-_93Oy15PW6wyRqf0w@mail.gmail.com>
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