1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++03, c++11, c++14, c++17 10 11 // <utility> 12 13 // inline constexpr auto __for_each_index_sequence = []<size_t... _Index>(index_sequence<_Index...>, auto __func) 14 15 #include <utility> 16 #include <cassert> 17 18 #include "test_macros.h" 19 test()20constexpr bool test() { 21 int count = 0; 22 std::__for_each_index_sequence(std::make_index_sequence<8>(), [&]<std::size_t _Index> { count += _Index; }); 23 assert(count == 28); 24 25 return true; 26 } 27 main(int,char **)28int main(int, char**) { 29 test(); 30 static_assert(test()); 31 32 return 0; 33 } 34