[libcxx-commits] [PATCH] D116380: [libc++] Use std::addressof in std::function::target

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 29 10:34:38 PST 2021


ldionne added a comment.

In D116380#3212861 <https://reviews.llvm.org/D116380#3212861>, @Quuxplusone wrote:

> I don't see the point of having //two// ADL-proofing tests (`robust_against_adl.pass.cpp` and the new one), and I wonder why the old `robust_against_adl.pass.cpp` bothered to test three different cases but you're adding only one new case (like, should there be a matching test for `std::function<int()>` as well as `std::function<void()>`?) but anyway this certainly seems code-correct and sufficiently-tested at this point. :)

The added test case in `addressof.pass.cpp` is not checking for ADL proofing, but really for the specific case of using `operator&` instead of `addressof`. For example, the ADL proofing test would pass if we used `__f_.__target().operator&()`, but the operator hijacking one would not. Since we can't reasonably use `.operator&()` (other stuff would fail), this is mostly academic, but I think it still makes sense to have a test whose *intent* is specifically to test the reported bug.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116380



More information about the libcxx-commits mailing list