[clang] [clang][Sema] Fix assertion crash on invalid concept template parameter (#225792) (PR #235408)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 25 23:27:03 PDT 2026


================
@@ -1540,7 +1538,36 @@ namespace {
         Designator.setInvalid();
         return;
       }
+
+      if(Base){
+        // Mark invalid and return early if Base points to an invalid decl
+        if(const auto *VD = Base.dyn_cast<const ValueDecl *>()){
+          if(VD->isInvalidDecl()){
+            Designator.setInvalid();
+            return;
+          }
+        }
+        // Mark invalid and return early if Base points to an invalid type
+        QualType BaseTy = getType(Base).getNonReferenceType();
+        if(BaseTy.isNull() || BaseTy->containsErrors() || (!BaseTy->isPointerType() && !BaseTy->isArrayType())){
+          Designator.setInvalid();
+          return;
+        }
+      }
+
----------------
Sriraj2911 wrote:

Sorry about that. I made a local Git error and accidentally pushed commits from another fix to this branch.

I've cleaned up the branch history so this PR strictly contains the fix and test for #225792.

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


More information about the cfe-commits mailing list