[libcxx-commits] [PATCH] D91708: [libc++] ADL-proof <vector> by adding _VSTD:: qualification on calls.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 19 09:26:36 PST 2020


Quuxplusone updated this revision to Diff 306429.
Quuxplusone retitled this revision from "[libcxx] Add some missing _VSTD:: to <vector>, with a regression test." to "[libc++] ADL-proof <vector> by adding _VSTD:: qualification on calls.".
Quuxplusone added a comment.

In my new test, `v.swap(w)` is not expected to work before C++14, because before C++14, there was some metaprogramming to make `vector<T>::swap` noexcept if-and-only-if the allocator was nothrow-swappable, which required looking up an ADL `swap` for the allocator type, which hit my ADL trap.

In C++14, `vector<T>::swap` is always noexcept, and so we don't have to look up an ADL `swap` (unless the allocator is POCS, which my test's `MyAlloc` is not), and therefore the test passes.

I admit that there is a plausible argument to be made that my new test is too "whitebox" and "overconstrained" and shouldn't even be checked in.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91708/new/

https://reviews.llvm.org/D91708

Files:
  libcxx/include/__hash_table
  libcxx/include/__split_buffer
  libcxx/include/__tree
  libcxx/include/deque
  libcxx/include/forward_list
  libcxx/include/list
  libcxx/include/memory
  libcxx/include/string
  libcxx/include/vector
  libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91708.306429.patch
Type: text/x-patch
Size: 12161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201119/8eedd168/attachment.bin>


More information about the libcxx-commits mailing list