[all-commits] [llvm/llvm-project] 7da4ee: [libcxx][NFC] Make sequence containers slightly mo...

Konstantin Varlamov via All-commits all-commits at lists.llvm.org
Wed Dec 1 11:57:21 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7da4ee6f23dd14464ee869caec18b5421d1cf7ca
      https://github.com/llvm/llvm-project/commit/7da4ee6f23dd14464ee869caec18b5421d1cf7ca
  Author: Konstantin Varlamov <varconst at apple.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libcxx/include/__memory/allocator_traits.h
    M libcxx/include/deque
    M libcxx/include/forward_list
    M libcxx/include/list
    M libcxx/include/vector
    M libcxx/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp
    M libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp

  Log Message:
  -----------
  [libcxx][NFC] Make sequence containers slightly more SFINAE-friendly during CTAD.

Disable the constructors taking `(size_type, const value_type&,
allocator_type)` if `allocator_type` is not a valid allocator.
Otherwise, these constructors are considered when resolving e.g.
`(int*, int*, NotAnAllocator())`, leading to a hard error during
instantiation. A hard error makes the Standard's requirement to not
consider deduction guides of the form `(Iterator, Iterator,
BadAllocator)` during overload resolution essentially non-functional.

The previous approach was to SFINAE away `allocator_traits`. This patch
SFINAEs away the specific constructors instead, for consistency with
`basic_string` -- see [LWG3076](wg21.link/lwg3076) which describes
a very similar problem for strings (note, however, that unlike LWG3076,
no valid constructor call is affected by the bad instantiation).

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




More information about the All-commits mailing list