Fix FP initializerList with base member (#5862)
This commit is contained in:
parent
c21166565f
commit
9fceba4fbc
|
@ -2675,6 +2675,8 @@ void CheckClass::initializerListOrder()
|
|||
const Token* const end = tok->next()->link();
|
||||
for (; tok != end; tok = tok->next()) {
|
||||
if (const Variable* argVar = scope->getVariable(tok->str())) {
|
||||
if (scope != argVar->scope())
|
||||
continue;
|
||||
if (var->isPointer() && (argVar->isArray() || Token::simpleMatch(tok->astParent(), "&")))
|
||||
continue;
|
||||
if (var->isReference())
|
||||
|
|
|
@ -7623,6 +7623,15 @@ private:
|
|||
" int i{};\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkInitializerListOrder("struct B {\n"
|
||||
" int a{}, b{};\n"
|
||||
"};\n"
|
||||
"struct D : B {\n"
|
||||
" D() : B(), j(b) {}\n"
|
||||
" int j;\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
#define checkInitializationListUsage(code) checkInitializationListUsage_(code, __FILE__, __LINE__)
|
||||
|
|
Loading…
Reference in New Issue