Skip to content

Conversation

mizvekov
Copy link
Contributor

A SubstTemplateTypeParmPackType is one of the types which may appear in a NestedNameSpecifier, so add it to the list of expected types in TreeTransform.

This fixes a regression introduced in #147835, which has never been released, so there are no release notes.

Fixes #154270

@mizvekov mizvekov self-assigned this Aug 19, 2025
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Aug 19, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 19, 2025

@llvm/pr-subscribers-clang

Author: Matheus Izvekov (mizvekov)

Changes

A SubstTemplateTypeParmPackType is one of the types which may appear in a NestedNameSpecifier, so add it to the list of expected types in TreeTransform.

This fixes a regression introduced in #147835, which has never been released, so there are no release notes.

Fixes #154270


Full diff: https://github.com/llvm/llvm-project/pull/154418.diff

2 Files Affected:

  • (modified) clang/lib/Sema/TreeTransform.h (+1)
  • (modified) clang/test/SemaTemplate/nested-name-spec-template.cpp (+12)
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 51f58e35a1ef4..f46cb675805b5 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -5417,6 +5417,7 @@ QualType TreeTransform<Derived>::TransformTypeInObjectScope(
   case TypeLoc::Typedef:
   case TypeLoc::TemplateSpecialization:
   case TypeLoc::SubstTemplateTypeParm:
+  case TypeLoc::SubstTemplateTypeParmPackType:
   case TypeLoc::PackIndexing:
   case TypeLoc::Enum:
   case TypeLoc::Record:
diff --git a/clang/test/SemaTemplate/nested-name-spec-template.cpp b/clang/test/SemaTemplate/nested-name-spec-template.cpp
index e6cbe3812da52..6d4d759ab6b86 100644
--- a/clang/test/SemaTemplate/nested-name-spec-template.cpp
+++ b/clang/test/SemaTemplate/nested-name-spec-template.cpp
@@ -167,3 +167,15 @@ namespace unresolved_using {
   };
   template struct C<int>;
 } // namespace unresolved_using
+
+namespace SubstTemplateTypeParmPackType {
+  template <int...> struct A {};
+
+  template <class... Ts> void f() {
+    []<int ... Is>(A<Is...>) { (Ts::g(Is) && ...); }(A<0>{});
+  };
+
+  struct B { static void g(int); };
+
+  template void f<B>();
+} // namespace SubstTemplateTypeParmPackType

A SubstTemplateTypeParmPackType is one of the types which may appear
in a NestedNameSpecifier, so add it to the list of expected types in TreeTransform.

This fixes a regression introduced in #147835, which has never been released, so
there are no release notes.

Fixes #154270
@mizvekov mizvekov force-pushed the users/mizvekov/GH154270 branch from dc7bbfc to a657d37 Compare August 19, 2025 20:18
@mizvekov mizvekov merged commit ec6389d into main Aug 19, 2025
9 checks passed
@mizvekov mizvekov deleted the users/mizvekov/GH154270 branch August 19, 2025 21:32
dyung added a commit to dyung/llvm-project that referenced this pull request Aug 20, 2025
@rupprecht
Copy link
Collaborator

Verified this on unreduced input, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[clang] unexpected type class: UNREACHABLE executed at ... TreeTransform.h
4 participants