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

904. result_of argument types

Section: 99 [func.ret] Status: C++11 Submitter: Jonathan Wakely Opened: 2008-09-10 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [func.ret].

View all issues with C++11 status.

Discussion:

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));

[ Post Summit: ]

Recommend Tentatively Ready.

Proposed resolution:

Change 99 [func.ret], p1:

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