Skip to content

Commit 10fc9a6

Browse files
committed
[Clang][Sema] Add nullptr check in IsFunctionConversion
Static analysis flagged this code b/c ToFPT could be nullptr but we were not checking it even though in the previous if statement we did. It looks like this was a mistaken refactor from: llvm#135836 In the older code ToFPT was set using a cast which would have asserted but no longer in the new code.
1 parent 52c9489 commit 10fc9a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Sema/SemaOverload.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType,
19791979
}
19801980

19811981
// Drop 'noexcept' if not present in target type.
1982-
if (FromFPT) {
1982+
if (FromFPT && ToFPT) {
19831983
if (FromFPT->isNothrow() && !ToFPT->isNothrow()) {
19841984
FromFn = cast<FunctionType>(
19851985
Context.getFunctionTypeWithExceptionSpec(QualType(FromFPT, 0),

0 commit comments

Comments
 (0)