https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97207
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- OK, so diff --git a/gcc/vec.c b/gcc/vec.c index a28899170ed..0cda3b96beb 100644 --- a/gcc/vec.c +++ b/gcc/vec.c @@ -560,6 +560,9 @@ vec_c_tests () test_qsort (); test_reverse (); test_auto_delete_vec (); + auto_vec<int> a; + auto_vec<int> b; + std::swap (a, b); } } // namespace selftest produces a similar error: /home/rguenther/src/gcc3/gcc/vec.c: In function 'void selftest::vec_c_tests()': /home/rguenther/src/gcc3/gcc/vec.c:565:18: error: no matching function for call to 'swap(auto_vec<int>&, auto_vec<int>&)' std::swap (a, b); ^ In file included from /usr/include/c++/7/bits/nested_exception.h:40:0, from /usr/include/c++/7/exception:143, from /usr/include/c++/7/new:40, from /home/rguenther/src/gcc3/gcc/system.h:236, from /home/rguenther/src/gcc3/gcc/vec.c:30: /usr/include/c++/7/bits/move.h:187:5: note: candidate: template<class _Tp> typename std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >::value>::type std::swap(_Tp&, _Tp&) swap(_Tp& __a, _Tp& __b) ^~~~ /usr/include/c++/7/bits/move.h:187:5: note: template argument deduction/substitution failed: /usr/include/c++/7/bits/move.h: In substitution of 'template<class _Tp> typename std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >::value>::type std::swap(_Tp&, _Tp&) [with _Tp = auto_vec<int>]': /home/rguenther/src/gcc3/gcc/vec.c:565:18: required from here /usr/include/c++/7/bits/move.h:187:5: error: no type named 'type' in 'struct std::enable_if<false, void>' /usr/include/c++/7/bits/move.h:210:5: note: candidate: template<class _Tp, long unsigned int _Nm> typename std::enable_if<std::__is_swappable<_Tp>::value>::type std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm]) swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) ^~~~ /usr/include/c++/7/bits/move.h:210:5: note: template argument deduction/substitution failed: /home/rguenther/src/gcc3/gcc/vec.c:565:18: note: mismatched types '_Tp [_Nm]' and 'auto_vec<int>' std::swap (a, b); ^ In file included from /usr/include/c++/7/utility:70:0, from /home/rguenther/src/gcc3/gcc/system.h:237, from /home/rguenther/src/gcc3/gcc/vec.c:30: /usr/include/c++/7/bits/stl_pair.h:495:5: note: candidate: template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&) swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) ^~~~ /usr/include/c++/7/bits/stl_pair.h:495:5: note: template argument deduction/substitution failed: /home/rguenther/src/gcc3/gcc/vec.c:565:18: note: 'auto_vec<int>' is not derived from 'std::pair<_T1, _T2>' std::swap (a, b); ^ In file included from /usr/include/c++/7/utility:70:0, from /home/rguenther/src/gcc3/gcc/system.h:237, from /home/rguenther/src/gcc3/gcc/vec.c:30: /usr/include/c++/7/bits/stl_pair.h:503:5: note: candidate: template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&) <deleted> swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; ^~~~ /usr/include/c++/7/bits/stl_pair.h:503:5: note: template argument deduction/substitution failed: /home/rguenther/src/gcc3/gcc/vec.c:565:18: note: 'auto_vec<int>' is not derived from 'std::pair<_T1, _T2>' std::swap (a, b); ^ make: *** [Makefile:1123: vec.o] Error 1 IMHO looks like a libstdc++ bug to me?