Implement sane variant converting constructor (P0608R3)
authorJonathan Wakely <jwakely@redhat.com>
Thu, 16 May 2019 20:30:35 +0000 (21:30 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 16 May 2019 20:30:35 +0000 (21:30 +0100)
commitd069df01eda5094cb2c934a7e1567219ba36e511
tree7ff15df0c3b8141371e384465d6b7d8ea68ce04f
parentb62dcd16aa033968075f19631c757bb39a16ef92
Implement sane variant converting constructor (P0608R3)

* include/std/variant (__overload_set): Remove.
(_Arr): New helper.
(_Build_FUN): New class template to define a single FUN overload,
with specializations to prevent unwanted conversions, as per P0608R3.
(_Build_FUNs): New class template to build an overload set of FUN.
(_FUN_type): New alias template to perform overload resolution.
(__accepted_type): Use integer_constant base for failure case. Use
_FUN_type for successful case.
(variant::__accepted_index): Use _Tp instead of _Tp&&.
(variant::variant(_Tp&&)): Likewise.
(variant::operator=(_Tp&&)): Likewise.

From-SVN: r271296
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/variant
libstdc++-v3/testsuite/20_util/variant/compile.cc
libstdc++-v3/testsuite/20_util/variant/run.cc