gcc/testsuite/g++.dg/cpp26/pack-indexing21.C
raw| 1 | // PR c++/124198 |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | // { dg-options "" } |
| 4 | |
| 5 | struct A { |
| 6 | constexpr A () : a (1) {} |
| 7 | int a; |
| 8 | constexpr operator int () const { return a; } |
| 9 | }; |
| 10 | |
| 11 | template <int ...N> |
| 12 | int |
| 13 | foo () |
| 14 | { |
| 15 | constexpr A a; |
| 16 | return N...[a]; // { dg-warning "pack indexing only available with" "" { target c++23_down } } |
| 17 | } |
| 18 | |
| 19 | int a = foo <1, 2, 3> (); |