================
@@ -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;
+
----------------
mizvekov wrote:

So we could instead, where the 'err_unsupported_placeholder_constraint' 
diagnostic is produced in `Sema::AttachTypeConstraint`, do a:
```C++
NewConstrainedParm->setType(TL.getType());
```

That would recover as if the user wrote the simpler supported plain constrained 
'auto'.

I prefer these kinds of solutions that keep the AST valid.

https://github.com/llvm/llvm-project/pull/209893
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to