Consider
#include <list>
//...
std::list<int> i,i2;
swap(move(i),move(i2));
This code should compile fine. Unfortunately it does not compile on gcc 4.4.1.
Error message:
xxx:xx: error: no matching function for call to 'swap(std::list<int,
std::allocator<int> >, std::list<int, std::allocator<int> >)'
c:\program files
(x86)\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/thread:202: note:
candidates are: void std::swap(std::thread&, std::thread&&)
c:\program files
(x86)\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/thread:198: note:
void std::swap(std::thread&&, std::thread&)
c:\program files
(x86)\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/thread:194: note:
void std::swap(std::thread&, std::thread&)
c:\program files
(x86)\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_list.h:1527:
note: void std::swap(std::list<_Tp, _Alloc>&, std::list<_Tp,
_Alloc>&&) [with _Tp = int, _Alloc = std::allocator<int>]
c:\program files
(x86)\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_list.h:1522:
note: void std::swap(std::list<_Tp, _Alloc>&&, std::list<_Tp,
_Alloc>&) [with _Tp = int, _Alloc = std::allocator<int>]
c:\program files
(x86)\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_list.h:1516:
note: void std::swap(std::list<_Tp, _Alloc>&, std::list<_Tp,
_Alloc>&) [with _Tp = int, _Alloc = std::allocator<int>]
c:\program files
(x86)\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/move.h:76: note:
void std::swap(_Tp&, _Tp&) [with _Tp = std::list<int,
std::allocator<int> >]
--
Summary: ADL being kinky
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: c2841847 at tyldd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41568