[clang] Skip out on checking NTTP equivilents when one is invalid (PR #209893)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 09:41:22 PDT 2026


================
@@ -8281,6 +8281,13 @@ static bool MatchTemplateParameterKind(
     if (Kind != Sema::TPL_TemplateTemplateParmMatch ||
         (!OldNTTP->getType()->isDependentType() &&
          !NewNTTP->getType()->isDependentType())) {
+
+      // Matching against an invalid declaration is going to be rife with
+      // errors, particularly when `getUnconstrainedType` isn't really valid
+      // there. Just treat these as otherwise invalid.
+      if (OldNTTP->isInvalidDecl() || NewNTTP->isInvalidDecl())
+        return false;
+
----------------
erichkeane wrote:

Yeah, I like that better too.  I thought about that at one point but was less confident that we wouldn't ruin any dependencies though.  I'll think about it further.

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


More information about the cfe-commits mailing list