Daniel Jacobowitz wrote:
severity 478734 normal
thanks
On Wed, Apr 30, 2008 at 11:55:19AM -0500, Jason Kraftcheck wrote:
Severity: grave
This is not grave, g++ is perfectly usable for other code.
I emmits the following error message:
bug.cc: In function 'int main()':
bug.cc:6: error: no matching function for call to 'std::vector<int,
std::allocator<int> >::swap(std::vector<int, std::allocator<int> >)'
/usr/include/c++/4.2/bits/stl_vector.h:728: note: candidates are: void
std::vector<_Tp, _Alloc>::swap(std::vector<_Tp, _Alloc>&) [with _Tp =
int, _Alloc = std::allocator<int>]
I'm pretty sure GCC is correct to refuse this. The result of a cast
is an rvalue, so you can not take a reference to it.
Why can't I take a reference to an rvalue? The temporary is guaranteed
to exist until the completion of the function it is passed to. Further,
the error message doesn't indicate that g++ interpreted the argument as
const.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]