I am struggling to fix and understand this simple code reported as erroneous by the compiler which is supposed to define the call operator for Klass
:
template<typename T>
class Klass{
T operator(){ return T; }
};
g++ 7.3 reports:
a.cpp:3:26: error: declaration of ‘operator()’ as non-function
T operator(){ return T; }
^
a.cpp:3:26: error: expected ‘;’ at end of member declaration
What is wrong?