================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to