fork download
  1. template <typename T>
  2. struct A
  3. {
  4. template <typename U>
  5. friend void foo(A<U>) {}
  6. };
  7.  
  8. int main()
  9. {
  10. A<char> a1;
  11. A<double> a2;
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘A<double>’:
prog.cpp:11:   instantiated from here
prog.cpp:5: error: redefinition of ‘template<class U> void foo(A<U>)’
prog.cpp:5: error: ‘template<class U> void foo(A<U>)’ previously defined here
prog.cpp: In function ‘int main()’:
prog.cpp:10: warning: unused variable ‘a1’
prog.cpp:11: warning: unused variable ‘a2’
stdout
Standard output is empty