1187. std::decay

Section: 23.15.7.6 [meta.trans.other] Status: C++11 Submitter: Jason Merrill Opened: 2009-08-07 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [meta.trans.other].

View all issues with C++11 status.

Discussion:

I notice that std::decay is specified to strip the cv-quals from anything but an array or pointer. This seems incorrect for values of class type, since class rvalues can have cv-qualified type (8.2.1 [basic.lval]/9).

[ 2009-08-09 Howard adds: ]

See the thread starting with c++std-lib-24568 for further discussion. And here is a convenience link to the original proposal. Also see the closely related issue 705.

[ 2010 Pittsburgh: Moved to Ready. ]

Proposed resolution:

Add a note to decay in 23.15.7.6 [meta.trans.other]:

[Note: This behavior is similar to the lvalue-to-rvalue (4.1), array-to-pointer (4.2), and function-to-pointer (4.3) conversions applied when an lvalue expression is used as an rvalue, but also strips cv-qualifiers from class types in order to more closely model by-value argument passing. — end note]