[clang] [clang][Sema] Add checks for validity of default ctor's class (PR #78898)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 07:42:47 PST 2024


================
@@ -14030,6 +14034,9 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
 
   CXXRecordDecl *ClassDecl = Constructor->getParent();
   assert(ClassDecl && "DefineImplicitDefaultConstructor - invalid constructor");
+  if (ClassDecl->isInvalidDecl()) {
+    return;
+  }
----------------
AaronBallman wrote:

```suggestion
  if (ClassDecl->isInvalidDecl())
    return;
```

https://github.com/llvm/llvm-project/pull/78898


More information about the cfe-commits mailing list