[all-commits] [llvm/llvm-project] f599e7: [libc++] Refactor __perfect_forward, bind_front an...

Louis Dionne via All-commits all-commits at lists.llvm.org
Mon Aug 9 12:32:46 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f599e7a789cb3983c40541164dad64f62bf9d887
      https://github.com/llvm/llvm-project/commit/f599e7a789cb3983c40541164dad64f62bf9d887
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2021-08-09 (Mon, 09 Aug 2021)

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

  Log Message:
  -----------
  [libc++] Refactor __perfect_forward, bind_front and not_fn

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.

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




More information about the All-commits mailing list