fork(7) download
  1. #include <iostream>
  2.  
  3. template<typename T>
  4. void foo(T x)
  5. {
  6. bar(x); // OKAY
  7. }
  8.  
  9. template<typename T>
  10. void bar(T x)
  11. {
  12. std::cout << x << '\n';
  13. }
  14.  
  15. int main() {
  16. foo(7);
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘void foo(T) [with T = int]’:
prog.cpp:16:7:   required from here
prog.cpp:6:10: error: ‘bar’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
     bar(x);   // OKAY
          ^
prog.cpp:10:6: note: ‘template<class T> void bar(T)’ declared here, later in the translation unit
 void bar(T x)
      ^
stdout
Standard output is empty