[clang] [clang][Sema] fix crash on __type_pack_element with dependent packs (GH180307) (PR #180407)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 9 02:13:57 PST 2026
================
@@ -43,3 +43,8 @@ static_assert(__is_same(__type_pack_element<5, X<0>, X<1>, X<2>, X<3>, X<4>, X<5
template <SizeT Index, typename ...T>
using ErrorTypePackElement1 = __type_pack_element<Index, T...>; // expected-error{{may not be accessed at an out of bounds index}}
using illformed1 = ErrorTypePackElement1<3, X<0>, X<1>>; // expected-note{{in instantiation}}
+
+template <SizeT... Seq>
+void gh180307(__type_pack_element<Seq...>) {}
+
+using gh180307_empty = __type_pack_element<0>; // expected-error {{a parameter pack may not be accessed at an out of bounds index}}
----------------
ojhunt wrote:
We're adding more generic defense against incorrect builtin templates, it might be worth actually just making a separate test `clang/test/SemaCXX/builtin_templates_invalid_parameters.cpp` or something
https://github.com/llvm/llvm-project/pull/180407
More information about the cfe-commits
mailing list