Title
Encoding a functor and argument types as a function signature for is_callable and result_of is fragile
Status
resolved
Section
[meta.type.synop][meta.rel]
Submitter
United States

Created on 2017-02-03.00:00:00 last changed 86 months ago

Messages

Date: 2017-03-15.00:00:00

[ 2017-03-12, post-Kona ]

Resolved by p0604r0.

Date: 2017-02-15.00:00:00

[ 2017-02-24, Daniel comments ]

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

Date: 2017-02-15.00:00:00

[ 2017-02-22, Daniel comments ]

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

Date: 2017-02-07.11:22:58
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.

History
Date User Action Args
2017-03-12 23:04:12adminsetmessages: + msg9096
2017-03-12 23:04:12adminsetstatus: new -> resolved
2017-02-24 21:23:01adminsetmessages: + msg8997
2017-02-22 20:56:04adminsetmessages: + msg8983
2017-02-03 00:00:00admincreate