Last active
March 13, 2017 14:49
-
-
Save parkercoates/fe41d25455204d3ce01e05d608151fb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <list> | |
namespace ns { | |
struct S | |
{ | |
int i = 0; | |
bool operator<(const S & other) const { return i < other.i; } | |
}; | |
template<class vtx> | |
double distance(const vtx & v1, const vtx & v2) { return v2 - v1; } | |
void f() | |
{ | |
std::list<S> l; | |
l.sort(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In file included from /usr/include/c++/6.3.1/list:64:0, | |
from gcc-bug.cpp:1: | |
/usr/include/c++/6.3.1/bits/list.tcc: In instantiation of ‘void std::__cxx11::list<_Tp, _Alloc>::merge(std::__cxx11::list<_Tp, _Alloc>&&) [with _Tp = ns::S; _Alloc = std::allocator<ns::S>]’: | |
/usr/include/c++/6.3.1/bits/stl_list.h:1617:14: required from ‘void std::__cxx11::list<_Tp, _Alloc>::merge(std::__cxx11::list<_Tp, _Alloc>&) [with _Tp = ns::S; _Alloc = std::allocator<ns::S>]’ | |
/usr/include/c++/6.3.1/bits/list.tcc:486:3: required from ‘void std::__cxx11::list<_Tp, _Alloc>::sort() [with _Tp = ns::S; _Alloc = std::allocator<ns::S>]’ | |
gcc-bug.cpp:17:10: required from here | |
/usr/include/c++/6.3.1/bits/list.tcc:408:32: error: call of overloaded ‘distance(std::__cxx11::list<ns::S>::iterator&, std::__cxx11::list<ns::S>::iterator&)’ is ambiguous | |
size_t __dist = distance(__first2, __last2); | |
~~~~~~~~^~~~~~~~~~~~~~~~~~~ | |
In file included from /usr/include/c++/6.3.1/bits/stl_algobase.h:66:0, | |
from /usr/include/c++/6.3.1/list:60, | |
from gcc-bug.cpp:1: | |
/usr/include/c++/6.3.1/bits/stl_iterator_base_funcs.h:135:5: note: candidate: typename std::iterator_traits<_Iterator>::difference_type std::distance(_InputIterator, _InputIterator) [with _InputIterator = std::_List_iterator<ns::S>; typename std::iterator_traits<_Iterator>::difference_type = long int] | |
distance(_InputIterator __first, _InputIterator __last) | |
^~~~~~~~ | |
gcc-bug.cpp:12:8: note: candidate: double ns::distance(const vtx&, const vtx&) [with vtx = std::_List_iterator<ns::S>] | |
double distance(const vtx & v1, const vtx & v2) { return v2 - v1; } | |
^~~~~~~~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment