diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2017-06-28 18:18:30 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2017-06-28 18:18:30 +0000 |
commit | f8c16417a912b31345f829cd21d63909a93a7884 (patch) | |
tree | 9b47f357a0ef41460600a84100c1325db0d6c7f9 /libcxx/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp | |
parent | f01cd723a83fca70aa53fba87a13669327c903d6 (diff) | |
download | bcm5719-llvm-f8c16417a912b31345f829cd21d63909a93a7884.tar.gz bcm5719-llvm-f8c16417a912b31345f829cd21d63909a93a7884.zip |
Added failing tests for index out of range for tuple_element<pair<T1,T2>> and variant_alternative<>
llvm-svn: 306580
Diffstat (limited to 'libcxx/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp')
-rw-r--r-- | libcxx/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp b/libcxx/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp new file mode 100644 index 00000000000..cbaa2a568d5 --- /dev/null +++ b/libcxx/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp @@ -0,0 +1,32 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// <variant> + +// template <size_t I, class T> struct variant_alternative; // undefined +// template <size_t I, class T> struct variant_alternative<I, const T>; +// template <size_t I, class T> struct variant_alternative<I, volatile T>; +// template <size_t I, class T> struct variant_alternative<I, const volatile T>; +// template <size_t I, class T> +// using variant_alternative_t = typename variant_alternative<I, T>::type; +// +// template <size_t I, class... Types> +// struct variant_alternative<I, variant<Types...>>; + +#include <memory> +#include <type_traits> +#include <variant> + +int main() { + using V = std::variant<int, void *, const void *, long double>; + typename std::variant_alternative<4, V>::type foo; // expected-error@variant:* {{Index out of bounds in std::variant_alternative<>}} +} |