summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-07-01 03:54:54 +0000
committerEric Fiselier <eric@efcs.ca>2016-07-01 03:54:54 +0000
commit10b9a1bb422639cf47d4aaf13a38b74e68101bef (patch)
tree756482b2b79c1bc463b3c08922fdf35058f984ba /libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp
parent908b9e26a6644eb108390887914553a175b8d709 (diff)
downloadbcm5719-llvm-10b9a1bb422639cf47d4aaf13a38b74e68101bef.tar.gz
bcm5719-llvm-10b9a1bb422639cf47d4aaf13a38b74e68101bef.zip
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<Id...> is created. llvm-svn: 274330
Diffstat (limited to 'libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp')
-rw-r--r--libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.fail.cpp34
1 files changed, 34 insertions, 0 deletions
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.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <size_t I, class... Types>
+// class tuple_element<I, tuple<Types...> >
+// {
+// public:
+// typedef Ti type;
+// };
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+#include <type_traits>
+
+int main()
+{
+ using T = std::tuple<int, long, void*>;
+ 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}}
+
+}
OpenPOWER on IntegriCloud