Language
C++
Compiler
gcc 8.2.0
Options
Warnings
Boost 1.69.0
C++2a(GNU)
no pedantic
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.69.0/gcc-8.2.0/include -std=gnu++2a
prog.cc:28:26: error: declaration of 'operator+' as non-function
friend Test<T> operator + <T> (const Test<T>& lhs, const Test<T>& rhs);
^
prog.cc:28:26: error: expected ';' at end of member declaration
friend Test<T> operator + <T> (const Test<T>& lhs, const Test<T>& rhs);
^
;
prog.cc:28:28: error: expected unqualified-id before '<' token
friend Test<T> operator + <T> (const Test<T>& lhs, const Test<T>& rhs);
^
prog.cc:43:28: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(int argc, char* argv[])
^
prog.cc: In function 'int main(int, char**)':
prog.cc:43:10: warning: unused parameter 'argc' [-Wunused-parameter]
main(int argc, char* argv[])
~~~~^~~~
prog.cc:43:22: warning: unused parameter 'argv' [-Wunused-parameter]
main(int argc, char* argv[])
~~~~~~^~~~~~
prog.cc: In instantiation of 'Test<T> operator+(const Test<T>&, const Test<T>&) [with T = int]':
prog.cc:47:22: required from here
prog.cc:40:21: error: 'int Test<int>::m_value' is private within this context
return Test<T>(lhs.m_value + rhs.m_value);
~~~~^~~~~~~
prog.cc:34:4: note: declared private here
T m_value;
^~~~~~~
prog.cc:40:35: error: 'int Test<int>::m_value' is private within this context
return Test<T>(lhs.m_value + rhs.m_value);
~~~~^~~~~~~
prog.cc:34:4: note: declared private here
T m_value;
^~~~~~~
Exit Code:
1