// P2662R3 - Pack Indexing // PR c++/113798 // { dg-do compile { target c++26 } } // From LLVM's cxx2c-pack-indexing.cpp. template constexpr bool is_same = false; template constexpr bool is_same = true; template constexpr bool f (auto&&... p) { return is_same; } void g () { int a = 0; const int b = 0; static_assert(f(0)); static_assert(f(a)); static_assert(f(b)); } template struct A { enum E { x = p...[0] }; }; static_assert(A<42>::x == 42); struct S { }; template constexpr auto constant_initializer = p...[0]; constexpr auto InitOk = constant_initializer; consteval int evaluate(auto... p) { return p...[0]; } constexpr int x = evaluate(42, S{}); static_assert(x == 42); template struct IL{}; template struct TL{}; template struct SpliceImpl; template struct SpliceImpl, IL> { using type = TL; }; template using Splice = typename SpliceImpl::type; using type = Splice, IL<1, 2>>; static_assert(is_same>);