c++ - Why is lvalue to rvalue reference binding allowed on g++ 4.4.6? -


i'm learning rvalue feature of c++11. c++ primer 5th edition says rvalue reference can bind rvalue, when tried compile program, passed, , output 1 1.

i don't understand why. i'm using g++ 4.4.6, , compiled with

g++ -wall -std=c++0x test.cpp -o test

#include <iostream>  using namespace std;  int main() {     int = 0;     int &&rr = i;      rr = 1;     std::cout << rr << std::endl;     std::cout << << std::endl;      return 0; } 

the gcc 4.4 series first released in april 2009, , trunk closed regression , documentation fixes before that, in november 2008.

the rule prevents rvalue references binding lvalues voted standard in march 2009, paper n2844, after being first suggested in december 2008, in paper n2812.

thus, new rule couldn't possibly implemented in time gcc 4.4 (it in fact implemented gcc 4.5).


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -