fork download
  1. #include <iostream>
  2.  
  3.  
  4. template<typename>
  5. struct type {
  6.  
  7. template<typename T>
  8. friend void f(type<T>);
  9. };
  10.  
  11. template<typename T>
  12. void f(type<T>) {
  13. std::cout << "1" << std::endl;
  14. }
  15.  
  16. void f(type<char>) {
  17. std::cout << "2" << std::endl;
  18. }
  19.  
  20.  
  21. int main() {
  22. type<int> t1;
  23. type<char> t2;
  24. f(t1);
  25. f(t2);
  26. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
1
2