[all-commits] [llvm/llvm-project] a0839b: [libc++] Fix tuple assignment from types derived f...

Louis Dionne via All-commits all-commits at lists.llvm.org
Mon Feb 22 11:52:38 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a0839b14df6de99fe29bee7cdfff182d50de665d
      https://github.com/llvm/llvm-project/commit/a0839b14df6de99fe29bee7cdfff182d50de665d
  Author: Louis Dionne <ldionne at apple.com>
  Date:   2021-02-22 (Mon, 22 Feb 2021)

  Changed paths:
    M libcxx/include/tuple
    A libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.assign/array.extension.pass.cpp
    A libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp
    M libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp
    M libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp
    M libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
    M libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp
    A libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/derived_from_tuple_like.pass.cpp
    A libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/laziness.pass.cpp
    M libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp
    M libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp
    R libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp
    A libcxx/test/support/propagate_value_category.hpp

  Log Message:
  -----------
  [libc++] Fix tuple assignment from types derived from a tuple-like

The implementation of tuple's constructors and assignment operators
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) can't be assigned to a
tuple with corresponding members, when it should. This commit re-implements
the assignment operators (BUT NOT THE CONSTRUCTORS) in a way much closer
to the specification to get rid of this bug. Most of the tests have been
stolen from Eric's patch https://reviews.llvm.org/D27606.

As a fly-by improvement, tests for noexcept correctness have been added
to all overloads of operator=. We should tackle the same issue for the
tuple constructors in a future patch - I'm just trying to make progress
on fixing this long-standing bug.

PR17550
rdar://15837420

Differential Revision: https://reviews.llvm.org/D50106




More information about the All-commits mailing list