[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 10 11:03:50 PDT 2024


================
@@ -961,6 +961,7 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
 
   if (MLTAL.getNumSubstitutedLevels() == 0)
     return ConstrExpr;
+  MLTAL.setKind(TemplateSubstitutionKind::Rewrite);
----------------
mizvekov wrote:

The new difference introduced in this patch is that a Rewrite is depth preserving, while a specialization is not.

In this case, we want to rewrite a requires clause from another potential redeclaration to see if it matches, and confirm it really is a redeclaration.

If we don't preserve the depth here, this would trip a new assert, where we would be instantiating a requires clause at template depth 0, but then parenting it to a declaration at depth 1, which is incorrect.

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


More information about the cfe-commits mailing list