Skip to content

Commit b1c7801

Browse files
authored
[Clang][NFC] Adding note on details that are not immediately obvious (#138349)
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 3b4d563 commit b1c7801

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)