Skip to content

Commit 2ab0500

Browse files
autoantwortclaude
andcommitted
Remove workaround for function pointers returning a reference in CheckClass::constructors
Variable::isReference() is no longer true for them (#15094). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1516cd2 commit 2ab0500

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

‎lib/checkclass.cpp‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,11 @@ void CheckClassImpl::constructors()
351351
const bool cpp14OrLater = mSettings.standards.cpp >= Standards::CPP14;
352352
for (Usage& usage : usageList) {
353353
const Variable& var = *usage.var;
354-
// isReference() is also true for a function pointer that returns a reference
355-
const bool isReferenceMember = var.isReference() && var.nameToken() && Token::Match(var.nameToken()->previous(), "&|&&");
356-
357354
// check for C++11 initializer
358355
if (var.hasDefault()) {
359356
usage.init = true;
360357
hasAnyDefaultInit = true;
361-
} else if (!var.isStatic() && (isReferenceMember || (var.isConst() && !var.isClass()))) {
358+
} else if (!var.isStatic() && (var.isReference() || (var.isConst() && !var.isClass()))) {
362359
// the default constructor is deleted, so all members are initialized by every instance
363360
isDefaultConstructible = false;
364361
} else if (cpp14OrLater && !hasAnySelfInit && isInitialized(usage, FunctionType::eConstructor)) {

0 commit comments

Comments
 (0)