[clang] [NFC][Clang] Fix potential dereferencing of nullptr (PR #86759)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 27 15:42:23 PDT 2024


================
@@ -2974,7 +2974,7 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
     if (auto *FPrime = SemaRef.InstantiateFunctionDeclaration(
             F, TemplateArgListForBuildingFPrime, AliasTemplate->getLocation(),
             Sema::CodeSynthesisContext::BuildingDeductionGuides)) {
-      auto *GG = dyn_cast<CXXDeductionGuideDecl>(FPrime);
+      auto *GG = cast<CXXDeductionGuideDecl>(FPrime);
----------------
tahonermann wrote:

I think this looks fine too. It is not trivial to ensure, but seems reasonable.

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


More information about the cfe-commits mailing list