| 1 |
// P2662R3 - Pack Indexing |
| 2 |
// PR c++/113798 |
| 3 |
// { dg-do compile { target c++26 } } |
| 4 |
// From <https://github.com/itanium-cxx-abi/cxx-abi/issues/175>. |
| 5 |
|
| 6 |
template <class... T> struct tuple { |
| 7 |
template <unsigned I> T...[I] get(); |
| 8 |
}; |
| 9 |
|
| 10 |
int |
| 11 |
g () |
| 12 |
{ |
| 13 |
tuple<int> t; |
| 14 |
// { dg-final { scan-assembler "_ZN5tupleIJiEE3getILj0EEEDyJiET_v" } } |
| 15 |
return t.get<0>(); |
| 16 |
} |
| 17 |
|
| 18 |
template<typename T, typename U> concept C = true; |
| 19 |
template<typename T, auto U> concept D = true; |
| 20 |
template<typename ...T> struct A { |
| 21 |
template<int I, typename ...U> void f(T...[I], U...[I]) requires C<T...[I], U...[I]>; |
| 22 |
template<int I, auto ...U> void h(T...[I], decltype(U...[I])) requires D<T...[I], U...[I]>; |
| 23 |
}; |
| 24 |
|
| 25 |
void |
| 26 |
h () |
| 27 |
{ |
| 28 |
A<char, int, double> a; |
| 29 |
// { dg-final { scan-assembler "_ZN1AIJcidEE1fILi1EJiicEEEvDyJcidET_DyT0_T_Q1CIDyT_TL0__DyTL0_0_TL0__E" } } |
| 30 |
a.f<1, int, int, char>(1, 2); |
| 31 |
// { dg-final { scan-assembler "_ZN1AIJcidEE1hILi1EJLi2ELl3ELj4EEEEvDyJcidET_DtsyT0_T_EQ1DIDyT_TL0__XsyTL0_0_TL0__EE" } } |
| 32 |
a.h<1, 2, 3L, 4U>(1, 3L); |
| 33 |
} |
| 34 |
|
| 35 |
template <auto... U> struct E { |
| 36 |
template <unsigned I> decltype (U...[I]) get(); |
| 37 |
}; |
| 38 |
|
| 39 |
int |
| 40 |
i () |
| 41 |
{ |
| 42 |
E<1, 2L, 3U, 4LL> t; |
| 43 |
// { dg-final { scan-assembler "_ZN1EIJLi1ELl2ELj3ELx4EEE3getILj2EEEDtsyJLi1ELl2ELj3ELx4EET_Ev" } } |
| 44 |
return t.get<2>(); |
| 45 |
} |