| 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 | // template <size_t I, class T, size_t N> T& get(array<T, N>& a); |
| 12 | |
| 13 | // Prevent -Warray-bounds from issuing a diagnostic when testing with clang verify. |
| 14 | // ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-array-bounds |
| 15 | |
| 16 | #include <array> |
| 17 | #include <cassert> |
| 18 | |
| 19 | void f() { |
| 20 | typedef double T; |
| 21 | typedef std::array<T, 3> C; |
| 22 | C c = {1, 2, 3.5}; |
| 23 | std::get<3>(arr&: c) = 5.5; // expected-note {{requested here}} |
| 24 | // expected-error-re@*:* {{static assertion failed{{( due to requirement '3U[L]{0,2} < 3U[L]{0,2}')?}}{{.*}}Index out of bounds in std::get<> (std::array)}} |
| 25 | } |
| 26 | |