[clang] [Sema] Fix crash in Sema::FindInstantiatedDecl (PR #96509)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 21:46:40 PDT 2024


================
@@ -6300,7 +6300,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
                   getTrivialTemplateArgumentLoc(UnpackedArg, QualType(), Loc));
           }
           QualType T = CheckTemplateIdType(TemplateName(TD), Loc, Args);
-          if (T.isNull())
+          if (T.isNull() || T->containsErrors())
----------------
Sirraide wrote:

Is there a reason this check isn’t done in `CheckTemplateIdType()` instead? Because there are a few other places where this exact pattern appears; is there a difference between this and other uses of `CheckTemplateIdType()` that makes it so it only makes sense to check for errors here (and if so, then that would probably deserve a comment explaining that)?

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


More information about the cfe-commits mailing list