parent
2ecab32fbe
commit
13ed2effa1
|
@ -2454,9 +2454,9 @@ void CheckClass::checkDuplInheritedMembersRecursive(const Type* typeCurrent, con
|
|||
for (const Variable &parentClassVarIt : parentClassIt.type->classScope->varlist) {
|
||||
if (classVarIt.name() == parentClassVarIt.name() && !parentClassVarIt.isPrivate()) { // Check if the class and its parent have a common variable
|
||||
duplInheritedMembersError(classVarIt.nameToken(), parentClassVarIt.nameToken(),
|
||||
typeCurrent->name(), parentClassIt.type->name(), classVarIt.name(),
|
||||
typeCurrent->classScope->type == Scope::eStruct,
|
||||
parentClassIt.type->classScope->type == Scope::eStruct);
|
||||
typeCurrent->name(), parentClassIt.type->name(), classVarIt.name(),
|
||||
typeCurrent->classScope->type == Scope::eStruct,
|
||||
parentClassIt.type->classScope->type == Scope::eStruct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -567,9 +567,9 @@ private:
|
|||
" int j;\n"
|
||||
"};\n"
|
||||
"class Derived2 : public Derived1 {\n"
|
||||
" int i;\n"
|
||||
" int i;\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:10]: (warning) The class 'Derived2' defines member variable with name 'i' also defined in its parent class 'Base'.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:10]: (warning) The class 'Derived2' defines member variable with name 'i' also defined in its parent class 'Base'.\n", errout.str());
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue