[clang] Fix crash on defaulted comparison recovery in Sema and AST (PR #210668)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 5 01:12:10 PDT 2026
================
@@ -3138,6 +3138,11 @@ FunctionDecl::DefaultedOrDeletedFunctionInfo::Create(
void FunctionDecl::setDefaultedOrDeletedInfo(
DefaultedOrDeletedFunctionInfo *Info) {
assert(!FunctionDeclBits.HasDefaultedOrDeletedInfo && "already have this");
+
+ // Guard against assertions tripping during error-recovery states
+ if (isInvalidDecl() || Body)
----------------
ojhunt wrote:
This change seems to be simply de-fanging the assertion - the assertion is not removed, it simply becomes a no-op because you have inserted an `if (... || Body)` gate.
This is a symptom gate - an assertion is an indication that something is wrong. The assertion itself is not the bug.
If you believe that the assertion is wrong, you need to include an explanation of why it is wrong. Hitting an assertion is not evidence the assertion is wrong.
https://github.com/llvm/llvm-project/pull/210668
More information about the cfe-commits
mailing list