forked from OSchip/llvm-project
Added failing tests for index out of range for tuple_element<pair<T1,T2>> and variant_alternative<>
llvm-svn: 306580
This commit is contained in:
parent
f01cd723a8
commit
f8c16417a9
|
@ -0,0 +1,22 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <utility>
|
||||
|
||||
// template <class T1, class T2> struct pair
|
||||
|
||||
// tuple_element<I, pair<T1, T2> >::type
|
||||
|
||||
#include <utility>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef std::pair<int, short> T;
|
||||
typename std::tuple_element<2, T>::type foo; // expected-error@utility:* {{Index out of bounds in std::tuple_element<std::pair<T1, T2>>}}
|
||||
}
|
|
@ -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<>}}
|
||||
}
|
Loading…
Reference in New Issue