Skip to content

Commit 8a140bc

Browse files
committed
Format
1 parent 19e3e3d commit 8a140bc

1 file changed

Lines changed: 14 additions & 27 deletions

File tree

lib/checkclass.cpp

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,6 @@ void CheckClass::constructors()
172172
if (!printWarnings)
173173
continue;
174174

175-
// #3196 => bailout if there are nested unions
176-
// TODO: handle union variables better
177-
// {
178-
// const bool bailout = std::any_of(scope->nestedList.cbegin(), scope->nestedList.cend(), [](const Scope* nestedScope) {
179-
// return nestedScope->type == ScopeType::eUnion;
180-
// });
181-
// if (bailout)
182-
// continue;
183-
// }
184-
185-
186175
std::vector<Usage> usageList = createUsageList(scope);
187176

188177
for (const Function &func : scope->functionList) {
@@ -310,22 +299,20 @@ void CheckClass::constructors()
310299
// If constructor is not in scope then we maybe using a constructor from a different template specialization
311300
if (!precedes(scope->bodyStart, func.tokenDef))
312301
continue;
313-
const Scope *varType = var.typeScope();
314-
{
315-
const bool derived = scope != var.scope();
316-
if (func.type == FunctionType::eConstructor &&
317-
func.nestedIn && (func.nestedIn->numConstructors - func.nestedIn->numCopyOrMoveConstructors) > 1 &&
318-
func.argCount() == 0 && func.functionScope &&
319-
func.arg && func.arg->link()->next() == func.functionScope->bodyStart &&
320-
func.functionScope->bodyStart->link() == func.functionScope->bodyStart->next()) {
321-
// don't warn about user defined default constructor when there are other constructors
322-
if (printInconclusive)
323-
uninitVarError(func.token, func.access == AccessControl::Private, func.type, var.scope()->className, var.name(), derived, true);
324-
} else if (missingCopy)
325-
missingMemberCopyError(func.token, func.type, var.scope()->className, var.name());
326-
else
327-
uninitVarError(func.token, func.access == AccessControl::Private, func.type, var.scope()->className, var.name(), derived, false);
328-
}
302+
303+
const bool derived = scope != var.scope();
304+
if (func.type == FunctionType::eConstructor &&
305+
func.nestedIn && (func.nestedIn->numConstructors - func.nestedIn->numCopyOrMoveConstructors) > 1 &&
306+
func.argCount() == 0 && func.functionScope &&
307+
func.arg && func.arg->link()->next() == func.functionScope->bodyStart &&
308+
func.functionScope->bodyStart->link() == func.functionScope->bodyStart->next()) {
309+
// don't warn about user defined default constructor when there are other constructors
310+
if (printInconclusive)
311+
uninitVarError(func.token, func.access == AccessControl::Private, func.type, var.scope()->className, var.name(), derived, true);
312+
} else if (missingCopy)
313+
missingMemberCopyError(func.token, func.type, var.scope()->className, var.name());
314+
else
315+
uninitVarError(func.token, func.access == AccessControl::Private, func.type, var.scope()->className, var.name(), derived, false);
329316
}
330317
}
331318
}

0 commit comments

Comments
 (0)