i have found code like the following in a project and get a warning by Cppcheck which i do not know is correct.
The code is like this simplified version:
It is marked inconclusive, so i am extra unsure if this code is correct or not.
Intuitively i would say Cppcheck could be right and calling the Base class move assignment operator should be moved after the other access of src.
I have found somewhat related but not perfectly matching stackoverflow questions, so i hope you experts here know more about it. I also appreciate any hint where i could read about such a case :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
i have found code like the following in a project and get a warning by Cppcheck which i do not know is correct.
The code is like this simplified version:
For the line 21 where it says
m_Foo = src.m_Foo;
the online Cppcheck demo prints this warning:It is marked inconclusive, so i am extra unsure if this code is correct or not.
Intuitively i would say Cppcheck could be right and calling the
Base
class move assignment operator should be moved after the other access ofsrc
.I have found somewhat related but not perfectly matching stackoverflow questions, so i hope you experts here know more about it. I also appreciate any hint where i could read about such a case :)