This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

2927. Encoding a functor and argument types as a function signature for is_callable and result_of is fragile

Section: 21.3.3 [meta.type.synop], 21.3.7 [meta.rel] Status: Resolved Submitter: United States Opened: 2017-02-03 Last modified: 2017-03-21

Priority: Not Prioritized

View other active issues in [meta.type.synop].

View all other issues in [meta.type.synop].

View all issues with Resolved status.

Discussion:

Addresses US 85

The trick of encoding a functor and argument types as a function signature for is_callable and result_of loses cv information on argument types, fails for non-decayed function types, and is confusing. E.g.,

typedef int MyClass::*mp; result_of_t<mp(const MyClass)>;
// should be const, but isn't
typedef int F(double); is_callable<F(float)>; // ill-formed

Minimal change:

Replace is_callable<Fn(ArgTypes...)> with is_callable<Fn, ArgTypes...> and replace is_callable<Fn(ArgTypes...), R> with is_callable_r<R, Fn, ArgTypes...>. Do the same for is_nothrow_callable.

Preferred change:

All of the above, plus deprecate result_of<Fn(ArgTypes...)> and replace it with result_of_invoke<Fn, ArgTypes...>

See also LWG 2895.

[2017-02-22, Daniel comments]

LWG 2895 provides now wording for this issue and for LWG 2928 as well.

[2017-02-24, Daniel comments]

I suggest to apply the paper d0604r0 instead, available on the Kona LWG wiki.

[2017-03-12, post-Kona]

Resolved by p0604r0.

Proposed resolution: