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

Matheus Izvekov via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 12 13:29:21 PDT 2025


================
@@ -606,8 +606,11 @@ TemplateArgumentLoc::TemplateArgumentLoc(ASTContext &Ctx,
       LocInfo(Ctx, TemplateKWLoc, QualifierLoc, TemplateNameLoc, EllipsisLoc) {
   assert(Argument.getKind() == TemplateArgument::Template ||
          Argument.getKind() == TemplateArgument::TemplateExpansion);
-  assert(QualifierLoc.getNestedNameSpecifier() ==
-         Argument.getAsTemplateOrTemplatePattern().getQualifier());
+  // We can't assume QualifierLoc.getNestedNameSpecifier() ==
+  // Argument.getAsTemplateOrTemplatePattern().getQualifier() at this point,
+  // because in template rewriting, we may substitute a DependentTemplateName
+  // (which has a NNSLoc) into a template template parameter (which
+  // doesn't have a NNSLoc).
----------------
mizvekov wrote:

That looks like a bug, hasn't it been fixed by one of my patches?

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


More information about the libcxx-commits mailing list