Disabled CheckClass::checkCopyCtorAndEqOperator because of FP (#8388)
This commit is contained in:
parent
df9df70ba7
commit
738fb1b23a
|
@ -2463,6 +2463,10 @@ enum CtorType {
|
|||
|
||||
void CheckClass::checkCopyCtorAndEqOperator()
|
||||
{
|
||||
// This is disabled because of #8388
|
||||
// The message must be clarified. How is the behaviour different?
|
||||
return;
|
||||
|
||||
if (!mSettings->isEnabled(Settings::WARNING))
|
||||
return;
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ private:
|
|||
"- Suspicious subtraction from 'this'\n"
|
||||
"- Call of pure virtual function in constructor/destructor\n"
|
||||
"- Duplicated inherited data members\n"
|
||||
"- If 'copy constructor' defined, 'operator=' also should be defined and vice versa\n"
|
||||
// disabled for now "- If 'copy constructor' defined, 'operator=' also should be defined and vice versa\n"
|
||||
"- Check that arbitrary usage of public interface does not result in division by zero\n"
|
||||
"- Check that the 'override' keyword is used when overriding virtual methods\n";
|
||||
}
|
||||
|
|
|
@ -266,14 +266,16 @@ private:
|
|||
" A(const A& other) { } \n"
|
||||
" int x;\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (warning) The class 'A' has 'copy constructor' but lack of 'operator='.\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:1]: (warning) The class 'A' has 'copy constructor' but lack of 'operator='.\n", "", errout.str());
|
||||
// TODO the error message should be clarified. It should say something like 'copy constructor is empty and will not assign i and therefore the behaviour is different to the default assignment operator'
|
||||
|
||||
checkCopyCtorAndEqOperator("class A \n"
|
||||
"{ \n"
|
||||
" A& operator=(const A& other) { return *this; }\n"
|
||||
" int x;\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (warning) The class 'A' has 'operator=' but lack of 'copy constructor'.\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:1]: (warning) The class 'A' has 'operator=' but lack of 'copy constructor'.\n", "", errout.str());
|
||||
// TODO the error message should be clarified. It should say something like 'assignment operator does not assign i and therefore the behaviour is different to the default copy constructor'
|
||||
|
||||
checkCopyCtorAndEqOperator("class A \n"
|
||||
"{ \n"
|
||||
|
|
Loading…
Reference in New Issue