[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#478734: g++-4.2: refuses to compile valid C++ syntax



On Wed, Apr 30, 2008 at 05:51:32PM -0500, Jason Kraftcheck wrote:
> Why can't I take a reference to an rvalue?

Because you can't modify rvalues.  This is the definition of the C++
language.  The next major revision of C++ will have T &&rref, the two
ampersands declaring an rvalue reference instead of the normal lvalue
kind.

> the error message doesn't indicate that g++ interpreted the argument as  
> const.

Const is not the same as lvalue/rvalue.  It says you tried to pass a
std::vector<int> where a std::vector<int> & was required and the fact
that that was an error suggests that taking a reference is not
possible here.

-- 
Daniel Jacobowitz
CodeSourcery



Reply to: