[libcxx-commits] [PATCH] D72640: [libcxx] Qualify make_pair in searcher implementations to prevent ADL

Logan Smith via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 13 12:37:49 PST 2020


logan-5 created this revision.
logan-5 added reviewers: mclow.lists, EricWF.
logan-5 added a project: libc++.
Herald added subscribers: libcxx-commits, ldionne, christof.

This patch adds `_VSTD::` to some calls to `make_pair` inside the implementations of searchers, to prevent things exploding if there is a make_pair in an associated namespace of a user-defined type. https://godbolt.org/z/xAFG98

I didn't fix (or add tests to) the Boyer-Moore or Boyer-Moore-Horspool searchers in `experimental/`, since I couldn't get those to work with user-defined types at all. After defining the hash function properly, there seems to be an issue with a `vector<value_type> __scratch` in a helper function that I don't understand. See https://godbolt.org/z/heJ75B -- the same code works with libstdc++. If this is a separate issue, I'd be happy to write up a bug. (Also, I don't even know... is the experimental/ stuff still actively supported/bugfixed/etc?)

I did, however, add tests to the regular (currently `XFAIL`ed) BM and BMH tests in `utilities`.

I found this (and a couple other issues, patches forthcoming) by running https://reviews.llvm.org/D72282 over libc++ locally.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72640

Files:
  libcxx/include/functional
  libcxx/test/std/algorithms/alg.nonmodifying/alg.search/search.pass.cpp
  libcxx/test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp
  libcxx/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp
  libcxx/test/std/utilities/function.objects/func.search/func.search.bm/default.pass.cpp
  libcxx/test/std/utilities/function.objects/func.search/func.search.bm/hash.pass.cpp
  libcxx/test/std/utilities/function.objects/func.search/func.search.bm/hash.pred.pass.cpp
  libcxx/test/std/utilities/function.objects/func.search/func.search.bm/pred.pass.cpp
  libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/default.pass.cpp
  libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/hash.pass.cpp
  libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/hash.pred.pass.cpp
  libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/pred.pass.cpp
  libcxx/test/std/utilities/function.objects/func.search/func.search.default/default.pass.cpp
  libcxx/test/std/utilities/function.objects/func.search/func.search.default/default.pred.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72640.237748.patch
Type: text/x-patch
Size: 68823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200113/fbed0e5e/attachment-0001.bin>


More information about the libcxx-commits mailing list