[clang] [Serialization] Handle uninitialized type constraints (PR #110496)

Florian Albrechtskirchinger via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 7 06:27:17 PDT 2024


================
@@ -1899,7 +1899,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
   Record.push_back(D->wasDeclaredWithTypename());
 
   const TypeConstraint *TC = D->getTypeConstraint();
-  assert((bool)TC == D->hasTypeConstraint());
+  Record.push_back(/*TypeConstraintInitialized=*/TC != nullptr);
   if (TC) {
----------------
falbrechtskirchinger wrote:

Because `D->hasTypeConstraint()` does not imply that `D->getTypeConstraint()` is non-null, as the code assumed (hence, the assertion).

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


More information about the cfe-commits mailing list