1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
13 // template <size_t I, class T> struct variant_alternative; // undefined
14 // template <size_t I, class T> struct variant_alternative<I, const T>;
15 // template <size_t I, class T> struct variant_alternative<I, volatile T>;
16 // template <size_t I, class T> struct variant_alternative<I, const volatile T>;
17 // template <size_t I, class T>
18 // using variant_alternative_t = typename variant_alternative<I, T>::type;
20 // template <size_t I, class... Types>
21 // struct variant_alternative<I, variant<Types...>>;
24 #include <type_traits>
27 int main(int, char**) {
28 using V
= std::variant
<int, void *, const void *, long double>;
29 std::variant_alternative
<4, V
>::type foo
; // expected-error@variant:* {{Index out of bounds in std::variant_alternative<>}}