[PATCH] D24110: [Sema] Don't diagnose an array type mismatch when the new or previous declaration has a dependent type

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 31 16:59:01 PDT 2016


rsmith added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:3370-3374
@@ -3369,7 +3369,7 @@
       // mismatch.
-      if (!NewArray->isIncompleteArrayType()) {
+      if (!NewArray->isIncompleteArrayType() && !NewArray->isDependentType()) {
         for (VarDecl *PrevVD = Old->getMostRecentDecl(); PrevVD;
              PrevVD = PrevVD->getPreviousDecl()) {
           const ArrayType *PrevVDTy = Context.getAsArrayType(PrevVD->getType());
-          if (PrevVDTy->isIncompleteArrayType())
+          if (PrevVDTy->isIncompleteArrayType() || PrevVDTy->isDependentType())
             continue;
----------------
Maybe use `isDependentSizedArrayType()` here instead, so we still diagnose cases where the element type is dependent but the array bound is non-dependent and differs.


https://reviews.llvm.org/D24110





More information about the cfe-commits mailing list