summaryrefslogtreecommitdiff
path: root/test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp')
-rw-r--r--test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp
new file mode 100644
index 0000000000000..3cf259f531c9c
--- /dev/null
+++ b/test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <experimental/tuple>
+
+// template <class F, class T> constexpr decltype(auto) apply(F &&, T &&)
+
+// Testing ref qualified functions
+
+#include <experimental/tuple>
+#include <cassert>
+
+struct func_obj
+{
+ constexpr func_obj() {}
+
+ constexpr int operator()() const & { return 1; }
+ constexpr int operator()() const && { return 2; }
+ constexpr int operator()() & { return 3; }
+ constexpr int operator()() && { return 4; }
+};
+
+namespace ex = std::experimental;
+
+int main()
+{
+// TODO(ericwf): Re-enable constexpr support
+/*
+ {
+ constexpr func_obj f;
+ constexpr std::tuple<> tp;
+
+ static_assert(1 == ex::apply(static_cast<func_obj const &>(f), tp), "");
+ static_assert(2 == ex::apply(static_cast<func_obj const &&>(f), tp), "");
+ }
+*/
+ {
+ func_obj f;
+ std::tuple<> tp;
+ assert(1 == ex::apply(static_cast<func_obj const &>(f), tp));
+ assert(2 == ex::apply(static_cast<func_obj const &&>(f), tp));
+ assert(3 == ex::apply(static_cast<func_obj &>(f), tp));
+ assert(4 == ex::apply(static_cast<func_obj &&>(f), tp));
+ }
+}