One VS2010 bug ? Allowing binding non-const reference to rvalue WITHOUT EVEN a warning?
That is a known issue/feature of the VS compilers. They have always allowed that and there does not seem to be any push into removing that extension.
That is a known issue/feature of the VS compilers. They have always allowed that and there does not seem to be any push into removing that extension.
Assume the declaration int a[10]; then all of the following are true: the type of the expression a is “10-element array of int“; except when a is the operand of the sizeof or unary & operators, the expression will be converted to an expression of type “pointer to int” and its value will be the … Read more
Expressions don’t have return types, they have a type and – as it’s known in the latest C++ standard – a value category. A conditional expression can be an lvalue or an rvalue. This is its value category. (This is somewhat of a simplification, in C++11 we have lvalues, xvalues and prvalues.) In very broad … Read more
Is bar an rvalue or an lvalue? The question answers itself. Whatever has a name is an lvalue(1). So bar is an lvalue. Its type is “rvalue reference to string“, but it’s an lvalue of that type. If you want to treat it as an rvalue, you need to apply std::move() to it. If you … Read more
Compilers are written in stages. The first stage is called the lexer and turns characters into a symbolic structure. So “++” becomes something like an enum SYMBOL_PLUSPLUS. Later, the parser stage turns this into an abstract syntax tree, but it can’t change the symbols. You can affect the lexer by inserting spaces (which end symbols … Read more