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 // <array> 10 11 // tuple_element<I, array<T, N> >::type 12 13 // Prevent -Warray-bounds from issuing a diagnostic when testing with clang verify. 14 #if defined(__clang__) 15 #pragma clang diagnostic ignored "-Warray-bounds" 16 #endif 17 18 #include <array> 19 #include <cassert> 20 21 // std::array is explicitly allowed to be initialized with A a = { init-list };. 22 // Disable the missing braces warning for this reason. 23 #include "disable_missing_braces_warning.h" 24 25 int main(int, char**) 26 { 27 { 28 typedef double T; 29 typedef std::array<T, 3> C; 30 std::tuple_element<3, C> foo; // expected-note {{requested here}} 31 // expected-error-re@array:* {{static_assert failed{{( due to requirement '3U[L]{0,2} < 3U[L]{0,2}')?}} "Index out of bounds in std::tuple_element<> (std::array)"}} 32 } 33 34 return 0; 35 } 36