Created on 2016-08-19.00:00:00 last changed 100 months ago
Proposed resolution:
This wording is relative to N4606.
Modify [func.not_fn], class call_wrapper synopsis, as indicated:
class call_wrapper
{
  […]
  template<class... Args>
    auto operator()(Args&&...) &
      -> decltype(!declval<result_of_t<FD&(Args&&...)>>());
  template<class... Args>
    auto operator()(Args&&...) const&
      -> decltype(!declval<result_of_t<FD const&(Args&&...)>>());
  template<class... Args>
    auto operator()(Args&&...) &&
      -> decltype(!declval<result_of_t<FD(Args&&...)>>());
  template<class... Args>
    auto operator()(Args&&...) const&&
      -> decltype(!declval<result_of_t<FD const(Args&&...)>>());
  […]
};
Modify the prototype declarations of [func.not_fn] as indicated:
template<class... Args> auto operator()(Args&&... args) & -> decltype(!declval<result_of_t<FD&(Args&&...)>>()); template<class... Args> auto operator()(Args&&... args) const& -> decltype(!declval<result_of_t<FD const&(Args&&...)>>());[…]
template<class... Args> auto operator()(Args&&... args) && -> decltype(!declval<result_of_t<FD(Args&&...)>>()); template<class... Args> auto operator()(Args&&... args) const&& -> decltype(!declval<result_of_t<FD const(Args&&...)>>());
[ 2016-09-09 Issues Resolution Telecon ]
P0; move to Tentatively Ready
The definition of the call_wrapper type in the C++17 CD means this fails to compile:
#include <functional>
struct abc { virtual void f() const = 0; };
struct derived : abc { void f() const { } };
struct F { bool operator()(abc&) { return false; } };
derived d;
bool b = std::not_fn(F{})(static_cast<abc&&>(d));
The problem is that the return types use result_of_t<F(abc)> and F(abc) is not a valid function type, because it takes an abstract class by value.
The return types should use result_of_t<F(Args&&...)> instead.| History | |||
|---|---|---|---|
| Date | User | Action | Args | 
| 2017-07-30 20:15:43 | admin | set | status: wp -> c++17 | 
| 2016-11-14 03:59:28 | admin | set | status: pending -> wp | 
| 2016-11-14 03:55:22 | admin | set | status: ready -> pending | 
| 2016-09-12 04:36:33 | admin | set | messages: + msg8508 | 
| 2016-09-12 04:36:33 | admin | set | status: new -> ready | 
| 2016-09-04 18:30:31 | admin | set | messages: + msg8491 | 
| 2016-08-19 00:00:00 | admin | create | |