[clang] [Clang][Sema] Fix crash in containsUnexpandedParameterPacks (PR #182484)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 21 19:42:15 PST 2026


================
@@ -1215,12 +1215,13 @@ bool Sema::containsUnexpandedParameterPacks(Declarator &D) {
       break;
     case DeclaratorChunk::Function:
       for (unsigned i = 0, e = Chunk.Fun.NumParams; i != e; ++i) {
-        ParmVarDecl *Param = cast<ParmVarDecl>(Chunk.Fun.Params[i].Param);
+        auto *Param = dyn_cast_or_null<ParmVarDecl>(Chunk.Fun.Params[i].Param);
----------------
ojhunt wrote:

This should not need to be a dyn_cast, just `cast` to `cast_or_null` should be sufficient.

no reason to switch to `auto` either.

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


More information about the cfe-commits mailing list