As reported on https://pvs-studio.com/en/blog/posts/cpp/0771/ (Snippet 2) - (and mentioned on rGdc4259d5a38409) we are repeating the T1.isNull() check instead of checking T2.isNull() as well.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaOverload.cpp | ||
---|---|---|
9528 | @rsmith Can these isNull checks ever fail? Or would we be better off changing them into an assert? QualType T1 = NextParam(F1, I1, I == 0); QualType T2 = NextParam(F2, I2, I == 0); assert(!T1.isNull() && !T2.isNull() && "Unknown types"); if (!Context.hasSameUnqualifiedType(T1, T2)) |
clang/lib/Sema/SemaOverload.cpp | ||
---|---|---|
9528 | that it's never ICED without checking T2's nullness suggests to me that they're never null. A null type here would seem to be from bad parsing, in which case why are we even checking further? IMHO assert now, there's plenty of time before C14 to revert that. |
clang/lib/Sema/SemaOverload.cpp | ||
---|---|---|
9528 | OK - I'll change this to an assertion |
FYI, it seems like a branch containing this patch was accidentally pushed to GitHub: https://github.com/llvm/llvm-project/tree/5357a98c823a
@rsmith Can these isNull checks ever fail? Or would we be better off changing them into an assert?