fork download
  1. template <class T> class A;
  2. template <class T, class U>
  3. void operator*(A<T>, A<U>);
  4.  
  5. template <class T>
  6. class A {
  7. template <class X, class U>
  8. friend void ::operator*(A<X>, A<U>);
  9. void friends_only();
  10. };
  11.  
  12. template <class T, class U>
  13. void operator*(A<T> a, A<U>) {
  14. a.friends_only();
  15. }
  16.  
  17. int m()
  18. {
  19. A<int> a;
  20. A<void> b;
  21. a*b;
  22. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
/home/KeFflr/ccmz5usj.o: In function `m()':
prog.cpp:(.text+0xf): undefined reference to `A<int>::friends_only()'
collect2: ld returned 1 exit status
stdout

Standard output is empty