#include <vector>
template<typename T>
void f(const typename std::vector<T>::iterator &) {}
void g() {
std::vector<int> v;
f<int>(v.end()); // Compiles.
f(v.end()); // Doesn't compile, gcc 4.3 can't find any match.
}
int main() { g(); }
I2luY2x1ZGUgPHZlY3Rvcj4KCnRlbXBsYXRlPHR5cGVuYW1lIFQ+CnZvaWQgZihjb25zdCB0eXBlbmFtZSBzdGQ6OnZlY3RvcjxUPjo6aXRlcmF0b3IgJikge30KCnZvaWQgZygpIHsKICBzdGQ6OnZlY3RvcjxpbnQ+IHY7CiAgZjxpbnQ+KHYuZW5kKCkpOyAgLy8gQ29tcGlsZXMuCiAgZih2LmVuZCgpKTsgIC8vIERvZXNuJ3QgY29tcGlsZSwgZ2NjIDQuMyBjYW4ndCBmaW5kIGFueSBtYXRjaC4KfQoKaW50IG1haW4oKSB7IGcoKTsgfQ==
prog.cpp: In function ‘void g()’:
prog.cpp:9:12: error: no matching function for call to ‘f(std::vector<int>::iterator)’
f(v.end()); // Doesn't compile, gcc 4.3 can't find any match.
^
prog.cpp:9:12: note: candidate is:
prog.cpp:4:6: note: template<class T> void f(const typename std::vector<T>::iterator&)
void f(const typename std::vector<T>::iterator &) {}
^
prog.cpp:4:6: note: template argument deduction/substitution failed:
prog.cpp:9:12: note: couldn't deduce template parameter ‘T’
f(v.end()); // Doesn't compile, gcc 4.3 can't find any match.
^