Title
result_of argument types
Status
c++11
Section
[func.ret]
Submitter
Jonathan Wakely

Created on 2008-09-10.00:00:00 last changed 162 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [func.ret], p1:

... The values ti are lvalues when the corresponding type Ti is an lvalue-reference type, and rvalues otherwise.

Date: 2010-10-21.18:28:33

[ Post Summit: ]

Recommend Tentatively Ready.

Date: 2008-09-10.00:00:00

The WP and TR1 have the same text regarding the argument types of a result_of expression:

The values ti are lvalues when the corresponding type Ti is a reference type, and rvalues otherwise.

I read this to mean that this compiles:

typedef int (*func)(int&);
result_of<func(int&&)>::type i = 0;

even though this doesn't:

int f(int&);
f( std::move(0) );

Should the text be updated to say "when Ti is an lvalue-reference type" or am I missing something?

I later came up with this self-contained example which won't compile, but I think it should:

struct X {
  void operator()(int&);
  int operator()(int&&);
} x;

std::result_of< X(int&&) >::type i = x(std::move(0));
History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg4300
2010-10-21 18:28:33adminsetmessages: + msg4299
2008-09-10 00:00:00admincreate