[libcxx-commits] [PATCH] D107199: [libc++] Refactor __perfect_forward, bind_front and not_fn

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 30 15:29:41 PDT 2021


ldionne created this revision.
ldionne requested review of this revision.
Herald added subscribers: libcxx-commits, aheejin.
Herald added a project: libc++.
Herald added a reviewer: libc++.

This patch fixes the constrains on the __perfect_forward constructor
and its call operators, which were incorrect. In particular, it makes
sure that we closely follow [func.require], which basically says that
we must deliver the bound arguments with the appropriate value category
or make the call ill-formed, but not silently fall back to using a
different value category.

As a fly-by, this patch also:

- Adds types __bind_front_t and __not_fn_t to make the result of calling bind_front and not_fn more opaque, and improve diagnostics for users.
- Adds a bunch of tests for bind_front and remove some that are now redundant.
- Adds some missing _LIBCPP_HIDE_FROM_ABI annotations.

Immense thanks to @tcanens for raising awareness about this issue, and
providing help with the = delete bits.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107199

Files:
  libcxx/include/__functional/bind_front.h
  libcxx/include/__functional/not_fn.h
  libcxx/include/__functional/perfect_forward.h
  libcxx/test/std/utilities/function.objects/func.bind_front/bind_front.pass.cpp
  libcxx/test/std/utilities/function.objects/func.bind_front/bind_front.verify.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107199.363228.patch
Type: text/x-patch
Size: 31547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210730/767df5ba/attachment-0001.bin>


More information about the libcxx-commits mailing list