1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9
10 // UNSUPPORTED: c++03, c++11, c++14
11
12 // <variant>
13
14 // template <size_t I, class T> struct variant_alternative; // undefined
15 // template <size_t I, class T> struct variant_alternative<I, const T>;
16 // template <size_t I, class T> struct variant_alternative<I, volatile T>;
17 // template <size_t I, class T> struct variant_alternative<I, const volatile T>;
18 // template <size_t I, class T>
19 // using variant_alternative_t = typename variant_alternative<I, T>::type;
20 //
21 // template <size_t I, class... Types>
22 // struct variant_alternative<I, variant<Types...>>;
23
24 #include <memory>
25 #include <type_traits>
26 #include <variant>
27
main(int,char **)28 int main(int, char**) {
29 using V = std::variant<int, void *, const void *, long double>;
30 std::variant_alternative<4, V>::type foo; // expected-error@variant:* {{Index out of bounds in std::variant_alternative<>}}
31
32 return 0;
33 }
34