[PATCH] D151529: [NFC][CLANG] Fix nullptr dereference issue in DeduceTemplateArgumentsByTypeMatch()

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 30 19:03:46 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcf236a037fd8: [NFC][CLANG] Fix nullptr dereference issue in… (authored by Manna).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151529/new/

https://reviews.llvm.org/D151529

Files:
  clang/lib/Sema/SemaTemplateDeduction.cpp


Index: clang/lib/Sema/SemaTemplateDeduction.cpp
===================================================================
--- clang/lib/Sema/SemaTemplateDeduction.cpp
+++ clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -1703,10 +1703,12 @@
       if (!IAA)
         return Sema::TDK_NonDeducedMismatch;
 
+      const auto *IAP = S.Context.getAsIncompleteArrayType(P);
+      assert(IAP && "Template parameter not of incomplete array type");
+
       return DeduceTemplateArgumentsByTypeMatch(
-          S, TemplateParams,
-          S.Context.getAsIncompleteArrayType(P)->getElementType(),
-          IAA->getElementType(), Info, Deduced, TDF & TDF_IgnoreQualifiers);
+          S, TemplateParams, IAP->getElementType(), IAA->getElementType(), Info,
+          Deduced, TDF & TDF_IgnoreQualifiers);
     }
 
     //     T [integer-constant]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151529.526867.patch
Type: text/x-patch
Size: 833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230531/763a9ddc/attachment.bin>


More information about the cfe-commits mailing list