fork download
  1.  
  2.  
  3. template <class T>
  4. class Int {
  5. public:
  6. T value;
  7. Int(const T& value_) : value(value_) {
  8. ;
  9. }
  10.  
  11. friend bool operator==(const Int<T>& f, const Int<T>& s);
  12. };
  13.  
  14. template <class T>
  15. bool operator==(const Int<T>& f, const Int<T>& s) {
  16. return f.value == s.value;
  17. }
  18.  
  19. int main() {
  20. int a;
  21. Int<int> x(a);
  22. x == a;
  23. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:22:7: warning: equality comparison result unused [-Wunused-comparison]
    x == a;
    ~~^~~~
prog.cpp:22:7: note: use '=' to turn this equality comparison into an assignment
    x == a;
      ^~
      =
1 warning generated.
/home/Q708ei/prog-dde773.o: In function `main':
prog.cpp:(.text+0xf): undefined reference to `operator==(Int<int> const&, Int<int> const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
stdout
Standard output is empty