This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


1026. Cv-qualified non-class rvalues

Section: 7.2.1  [basic.lval]     Status: NAD     Submitter: Jerry Coffin     Date: 2010-02-01

Historically, based on C's treatment, cv-qualification of non-class rvalues has been ignored in C++. With the advent of rvalue references, it's not quite as clear that this is desirable. For example, some implementations are reported to print const rvalue for the following program:

const int bar() {
   return 5;
}

void pass_int(int&& i) {
   printf("rvalue\n");
}

void pass_int(const int&& i) {
   printf("const rvalue\n");
}

int main() {
   pass_int(bar());
}

Rationale (August, 2010):

The current specification is as intended.