fork download
  1. #include <vector>
  2.  
  3. template<typename T>
  4. void f(const typename std::vector<T>::iterator &) {}
  5.  
  6. void g() {
  7. std::vector<int> v;
  8. f<int>(v.end()); // Compiles.
  9. f(v.end()); // Doesn't compile, gcc 4.3 can't find any match.
  10. }
  11.  
  12. int main() { g(); }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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.
            ^
stdout
Standard output is empty