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

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



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.

-- 
Daniel Jacobowitz
CodeSourcery



Reply to: