Skip to content

Commit 48a5b4a

Browse files
committed
[Clang][NFC] Adding note on details that are not immediately obvious
This code was flagged by static analysis. It was a false positive but the reason why this code is valid is subtle and folks refactoring this code in the future could easily miss it.
1 parent 70e303f commit 48a5b4a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clang/lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,9 @@ void Sema::PrintInstantiationStack(InstantiationContextDiagFuncRef DiagFunc) {
11371137
// FIXME: For synthesized functions that are not defaulted,
11381138
// produce a note.
11391139
auto *FD = dyn_cast<FunctionDecl>(Active->Entity);
1140+
// Note: if FD is nullptr currently setting DFK to DefaultedFunctionKind()
1141+
// will ensure that DFK.isComparison() is false. This is important because
1142+
// we will uncondtionally dereference FD in the else if.
11401143
DefaultedFunctionKind DFK =
11411144
FD ? getDefaultedFunctionKind(FD) : DefaultedFunctionKind();
11421145
if (DFK.isSpecialMember()) {

0 commit comments

Comments
 (0)