In r13-272 we hardened the *_PACK_EXPANSION and *_ARGUMENT_PACK macros.
That trips up here because make_pack_expansion returns error_mark_node
and we access that with PACK_EXPANSION_LOCAL_P.
PR c++/115425
gcc/cp/ChangeLog:
* pt.cc (tsubst_pack_expansion): Return error_mark_node if
make_pack_expansion doesn't work out.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/lambda-generic12.C: New test.
else
result = tsubst (pattern, args, complain, in_decl);
result = make_pack_expansion (result, complain);
+ if (result == error_mark_node)
+ return error_mark_node;
PACK_EXPANSION_LOCAL_P (result) = PACK_EXPANSION_LOCAL_P (t);
PACK_EXPANSION_SIZEOF_P (result) = PACK_EXPANSION_SIZEOF_P (t);
if (PACK_EXPANSION_AUTO_P (t))
--- /dev/null
+// PR c++/115425
+// { dg-do compile { target c++20 } }
+
+using size_t = decltype(sizeof(0));
+
+template <int... I>
+struct X {};
+
+template<int... Is>
+void foo(X<Is...>);
+
+template<auto>
+struct S;
+
+template<class T>
+auto test() {
+ constexpr static auto x = foo<X<__integer_pack (0)...>>(); // { dg-error "no matching function" }
+ return []<size_t... Is>(X<Is...>) {
+ (typename S<x[Is]>::type{}, ...);
+ }(X<__integer_pack (0)...>{});
+}
+
+int main() {
+ test<int>();
+}