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 10 11 // <variant> 12 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; 19 // 20 // template <size_t I, class... Types> 21 // struct variant_alternative<I, variant<Types...>>; 22 23 #include <memory> 24 #include <type_traits> 25 #include <variant> 26 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<>}} 30 31 return 0; 32 } 33