[clang] [libcxx] [Clang][WIP] Normalize constraints before checking for satisfaction (PR #141776)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 9 09:31:09 PDT 2025


================
@@ -234,23 +234,39 @@ enum class TemplateSubstitutionKind : char {
     /// Replaces the current 'innermost' level with the provided argument list.
     /// This is useful for type deduction cases where we need to get the entire
     /// list from the AST, but then add the deduced innermost list.
-    void replaceInnermostTemplateArguments(Decl *AssociatedDecl, ArgList Args) {
+    void replaceInnermostTemplateArguments(Decl *AssociatedDecl, ArgList Args,
+                                           bool Final = false) {
       assert((!TemplateArgumentLists.empty() || NumRetainedOuterLevels) &&
              "Replacing in an empty list?");
 
       if (!TemplateArgumentLists.empty()) {
-        assert((TemplateArgumentLists[0].AssociatedDeclAndFinal.getPointer() ||
-                TemplateArgumentLists[0].AssociatedDeclAndFinal.getPointer() ==
-                    AssociatedDecl) &&
-               "Trying to change incorrect declaration?");
+        // assert((!TemplateArgumentLists[0].AssociatedDeclAndFinal.getPointer()
+        // ||
+        //         TemplateArgumentLists[0].AssociatedDeclAndFinal.getPointer()
+        //         ==
+        //             AssociatedDecl) &&
+        //         "Trying to change incorrect declaration?");
         TemplateArgumentLists[0].Args = Args;
       } else {
         --NumRetainedOuterLevels;
         TemplateArgumentLists.push_back(
-            {{AssociatedDecl, /*Final=*/false}, Args});
+            {{AssociatedDecl, /*Final=*/Final}, Args});
       }
     }
 
+    void replaceOutermostTemplateArguments(Decl *AssociatedDecl, ArgList Args) {
+      assert((!TemplateArgumentLists.empty()) && "Replacing in an empty list?");
+      // assert((!TemplateArgumentLists.back().AssociatedDeclAndFinal.getPointer()
+      // ||
+      //         TemplateArgumentLists.back().AssociatedDeclAndFinal.getPointer()
+      //         ==
+      //             AssociatedDecl) &&
+      //        "Trying to change incorrect declaration?");
----------------
zyn0217 wrote:

ditto

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


More information about the cfe-commits mailing list