[PATCH] D50106: [libc++] Fix tuple assignment from type derived from a tuple-like

Louis Dionne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 31 14:38:18 PDT 2018


ldionne created this revision.
ldionne added reviewers: EricWF, mclow.lists.
Herald added subscribers: cfe-commits, dexonsmith, christof.

The implementation of operator= for tuple currently diverges from the way
the Standard specifies them, which leads to subtle cases where the behavior
is not as specified. In particular, a class derived from a tuple-like type
(e.g. pair) could not be assigned to a tuple with corresponding members.
This commit re-implements operator= in a way much closer to the specification
and gets rid of this bug. Tests have been stolen from EricWF's assignment
tests in https://reviews.llvm.org/D27606.

As a fly-by improvement, tests for noexcept correctness have been added to
all overloads of operator=.

PR17550
rdar://problem/15837420


Repository:
  rCXX libc++

https://reviews.llvm.org/D50106

Files:
  libcxx/include/tuple
  libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.assign/const_array.pass.cpp
  libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.assign/rvalue_array.pass.cpp
  libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp
  libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp
  libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp
  libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
  libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp
  libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/derived_from_tuple_like.pass.cpp
  libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp
  libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp
  libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp
  libcxx/test/support/propagate_value_category.hpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50106.158389.patch
Type: text/x-patch
Size: 32753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180731/c3911537/attachment-0001.bin>


More information about the cfe-commits mailing list