[all-commits] [llvm/llvm-project] 693827: [libcxx] Fix enable_if condition of std::reverse_i...

Mikhail Maltsev via All-commits all-commits at lists.llvm.org
Mon Nov 15 05:09:49 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6938270fa68d2242999802fdc306dc60326df020
      https://github.com/llvm/llvm-project/commit/6938270fa68d2242999802fdc306dc60326df020
  Author: Mikhail Maltsev <mikhail.maltsev at arm.com>
  Date:   2021-11-15 (Mon, 15 Nov 2021)

  Changed paths:
    M libcxx/include/__iterator/reverse_iterator.h
    M libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
    M libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cons/assign.pass.cpp

  Log Message:
  -----------
  [libcxx] Fix enable_if condition of std::reverse_iterator::operator=

The template std::is_assignable<T, U> checks that T is assignable from
U. Hence, the order of operands in the instantiation of
std::is_assignable in the std::reverse_iterator::operator= condition
should be reversed.

This issue remained unnoticed because std::reverse_iterator has an
implicit conversion constructor. This patch adds a test to check that
the assignment operator is used directly, without any implicit
conversions. The patch also adds a similar test for
std::move_iterator.

Reviewed By: Quuxplusone, ldionne, #libc

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




More information about the All-commits mailing list