Debian Codegraph @

gcc/testsuite/g++.dg/cpp26/pack-indexing19.C

raw
1 // PR c++/122169
2 // { dg-do compile { target c++26 } }
3
4 template<class T, class U>
5 concept same_as = __is_same(T, U);
6
7 template<class... Ts>
8 void f() {
9 using T = Ts...[0];
10 static_assert(same_as<const T, const int>);
11
12 []<int I>() {
13 using U = Ts...[I];
14 static_assert(same_as<const U, const int>);
15 }.template operator()<0>();
16 }
17
18 template void f<int>();
19
20
21 template<class... Ts>
22 void g() {
23 using T = Ts...[0];
24 static_assert(same_as<const T, const volatile int>);
25
26 []<int I>() {
27 using U = Ts...[I];
28 static_assert(same_as<const U, const volatile int>);
29 }.template operator()<0>();
30 }
31
32 template void g<volatile int>();