In get<0>, Is is empty, so the first parameter pack of the lambda is empty, but after the fix for PR94546 we were wrongly associating it with the partial instantiation of 'v'. gcc/cp/ChangeLog: PR c++/97246 PR c++/94546 * pt.c (extract_fnparm_pack): Check DECL_PACK_P here. (register_parameter_specializations): Not here. gcc/testsuite/ChangeLog: PR c++/97246 * g++.dg/cpp2a/lambda-generic-variadic21.C: New test.
20 lines
547 B
C
20 lines
547 B
C
// PR c++/97246
|
|
// { dg-do compile { target c++20 } }
|
|
|
|
template <int... Is, typename T>
|
|
T arg_T(decltype(Is)..., T, ...);
|
|
|
|
template <int I, int... Is>
|
|
inline constexpr auto get =
|
|
[]<typename... T>(decltype(Is)..., T... v, ...) {
|
|
static_assert( sizeof...(T) == sizeof...(v) );
|
|
if constexpr ( sizeof...(T) == 1 )
|
|
return (v,...);
|
|
else {
|
|
using V = decltype(arg_T<__integer_pack(I)...>(v...));
|
|
return get<I,__integer_pack(I)...>.template operator()<V>(v...);
|
|
}
|
|
};
|
|
|
|
static_assert( get<0>('\0', short{1}, 2, long{3}) == 0 );
|