fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template<typename T>
  6. class Size{
  7. public:
  8. Size& operator()()const;
  9. };
  10.  
  11. template<typename T>
  12. Size<T>& Size<T>::operator()()const{
  13. return (*this);
  14. }
  15.  
  16. int main() {
  17. Size<int> s;
  18. s();
  19. return 0;
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘Size<T>& Size<T>::operator()() const [with T = int]’:
prog.cpp:18:7:   required from here
prog.cpp:13:18: error: invalid initialization of reference of type ‘Size<int>&’ from expression of type ‘const Size<int>’
prog.cpp: In member function ‘Size<T>& Size<T>::operator()() const [with T = int]’:
prog.cpp:14:1: warning: control reaches end of non-void function [-Wreturn-type]
stdout
Standard output is empty