This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[v3 PATCH] Implement LWG 2842, in_place_t check for optional::optional(U&&) should decay U.


Tested on Linux-x64.

The perfect forwarder needs to sfinae out of the way of the in_place_t
signature,
and the in_place_t signature needs to check is_constructible. I also
did some housekeeping
to get rid of the int-pack constraints, because in case of empty packs
it's unclear
what a compiler is supposed to do for them.

2016-12-19  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Implement LWG 2842, in_place_t check for optional::optional(U&&)
    should decay U.
    * include/std/optional (_Optional_base(in_place_t, _Args&&...)):
    Constrain.
    (_Optional_base(in_place_t, initializer_list<_Up>, _Args&&...)):
    Turn the int-pack constraint hack into a saner bool.
    (_Optional_base<_Tp, false>::_Optional_base(in_place_t, _Args&&...)):
    Constrain.
    (_Optional_base<_Tp, false>::_Optional_base(in_place_t,
    initializer_list<_Up>, _Args&&...)):
    Turn the int-pack constraint hack into a saner bool.
    (optional(_Up&&)): Constrain against in_place_t.
    (optional(in_place_t, _Args&&...)): Constrain.
    (constexpr optional(in_place_t, initializer_list<_Up>, _Args&&...)):
    Turn the int-pack constraint hack into a saner bool.
    * testsuite/20_util/optional/cons/value_neg.cc: Add a test for
    a type that is constructible from in_place.

Attachment: lwg2842.diff
Description: Text document


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