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: [v3 PATCH] PR libstdc++/77288 and the newest proposed resolution for LWG 2756


On 23 August 2016 at 17:17, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> Tested on Linux-x64.
>
> N.B. I know that the assignment operators have constraints in template
> parameters, I want to move them to the return type separately.
>
> N.B2. This fixes the bug for std::optional only; I plan to port the fix
> to std::experimental::optional in a separate patch, and then backport
> that separate fix to 6.x.
>
> N.B3. The newest p/r for LWG 2756 is not up yet in the issue list,
> and hasn't been looked at by LEWG/LWG, but neither was the previous
> one. :) Nevertheless, this new p/r and the patch are a massive
> improvement, and keeps
> existing code and expectations working, makes all sorts of interesting types
> work, and keeps the conversion functionality.


A minor addition to avoid problems with scalars.

2016-09-06  Ville Voutilainen  <ville.voutilainen@gmail.com>

    PR libstdc++/77288
    * include/std/optional (__is_optional_impl, __is_optional): Remove.
    (__converts_from_optional, __assigns_from_optional): New.
    (optional(_Up&&)): Use is_same instead of __is_optional.
    (optional(const optional<_Up>&)): Constrain with
    __converts_from_optional.
    (optional(optional<_Up>&&)): Likewise.
    (operator=(_Up&&)): Use is_same instead of __is_optional, check
    is_same and is_scalar.
    (operator=(const optional<_Up>&)): Constrain with
    __converts_from_optional and __assigns_from_optional.
    (operator=(optional<_Up>&&)): Likewise.
    * testsuite/20_util/optional/77288.cc: New.
    * testsuite/20_util/optional/cons/value.cc: Adjust.

Attachment: lwg2756_3.diff
Description: Text document


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