Non-function-call xvalues and decltype
Section [dcl.type.simple]
Daniel Kr├╝gler

Created on 2010-10-21.00:00:00 last changed 96 months ago


Date: 2011-03-15.00:00:00

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

Date: 2010-11-15.00:00:00

Proposed resolution (November, 2010) [SUPERSEDED]:

Change [dcl.type.simple] paragraph 4 as follows:

The type denoted by decltype(e) is defined as follows:

  • if e is an unparenthesized id-expression or a class member access ( [expr.ref]), decltype(e) is the type of the entity named by e. If there is no such entity, or if e names a set of overloaded functions, the program is ill-formed;

  • otherwise, if e is a function call ( [expr.call]) or an invocation of an overloaded operator (parentheses around e are ignored), decltype(e) is the return type of the statically chosen function an xvalue, decltype(e) is T&&, where T is the type of e;

  • otherwise, if e is an lvalue, decltype(e) is T&, where T is the type of e;

  • otherwise, decltype(e) is the type of e.

Date: 2010-10-21.00:00:00


    int&& f();
    int i;

it is surprising that decltype(f()) and decltype(static_cast<int&&>(i)) are not the same type.

Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3333
2011-04-10 00:00:00adminsetstatus: review -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3089
2010-10-21 00:00:00admincreate