Using gcc version 4.4.3 as follows:
gcc -g -x c++ -lstdc++ -std=c++98 -o ./main ./main.cpp
this code in main.cpp compiles fine:
But if I uncomment aa = A(); , I get:
./main.cpp: In member function 'A& A::operator=(const A&)': ./main.cpp:4: error: non-static const member 'const bool A::m_flag', can't use default assignment operator ./main.cpp: In function 'int main(int, char**)': ./main.cpp:24: note: synthesized method 'A& A::operator=(const A&)' first required here
Why do default copy building and copy assignment work for copies on the stack, but not when replacing non-constant static with a copy?
source share