From 10b9a1bb422639cf47d4aaf13a38b74e68101bef Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Fri, 1 Jul 2016 03:54:54 +0000 Subject: Flatten the tuple_element and __make_tuple_types implementations. This patch attempts to improve the QoI of std::tuples tuple_element and __make_tuple_types helpers. Previously they required O(N) instantiations, one for every element in the tuple The new implementations are O(1) after __tuple_indices is created. llvm-svn: 274330 --- .../tuple.helper/tuple_element.fail.cpp | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp (limited to 'libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp') diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp new file mode 100644 index 00000000000..4cb73573e7c --- /dev/null +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template class tuple; + +// template +// class tuple_element > +// { +// public: +// typedef Ti type; +// }; + +// UNSUPPORTED: c++98, c++03 + +#include +#include + +int main() +{ + using T = std::tuple; + using E1 = typename std::tuple_element<1, T &>::type; // expected-error{{undefined template}} + using E2 = typename std::tuple_element<3, T>::type; + using E3 = typename std::tuple_element<4, T const>::type; + // expected-error@__tuple:* 2 {{static_assert failed}} + +} -- cgit v1.2.3