[Bug libstdc++/87855] std::optional<T> only copy-constructible if T is trivially copy-constructible

ville at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 19 15:06:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87855

--- Comment #17 from ville at gcc dot gnu.org ---
Author: ville
Date: Mon Nov 19 15:05:18 2018
New Revision: 266278

URL: https://gcc.gnu.org/viewcvs?rev=266278&root=gcc&view=rev
Log:
PR libstdc++/87855

Also implement P0602R4 (variant and optional
should propagate copy/move triviality) for std::optional.
* include/std/optional (_Optional_payload): Change
the main constraints to check constructibility in
addition to assignability.
(operator=): Make constexpr.
(_M_reset): Likewise.
(_M_construct): Likewise.
(operator->): Likewise.
* testsuite/20_util/optional/assignment/8.cc: Adjust.
* testsuite/20_util/optional/assignment/9.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/20_util/optional/assignment/9.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/optional
    trunk/libstdc++-v3/testsuite/20_util/optional/assignment/8.cc


More information about the Gcc-bugs mailing list