================
@@ -220,6 +220,14 @@ static ExprResult EvaluateAtomicConstraint(
     if (Inst.isInvalid())
       return ExprError();
 
+    if (const TemplateTypeParmType *TTPT =
+        
dyn_cast<TemplateTypeParmType>(AtomicExpr->getType().getDesugaredType(S.Context)))
 {
+      TemplateTypeParmDecl *TTPD = TTPT->getDecl();
+      if (TTPD->isInvalidDecl()) {
+        return ExprError();
+      }
+    }
+
----------------
mizvekov wrote:

Thanks for working on this!

So this fixes the problem too narrowly, only does anything for concepts.

I think a more general way to fix this, would be to make the type of a 
`TemplateTypeParmType` be non-dependent when it is invalid.

Since the type for a TTP decl is created when the declaration is created,  you 
could use `TTPDecl->setTypeForDecl(` to change its type to the built-in int 
type, which is a common error recovery strategy in clang.
You can do that at the same time as you set the TTP decl as invalid.

Double check you are doing this early enough: You want to change the type 
before the template parameter has any chance to be used.

https://github.com/llvm/llvm-project/pull/142278
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to