aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2021-06-08 12:12:04 -0400
committerLouis Dionne <ldionne.2@gmail.com>2021-06-08 12:17:10 -0400
commitd2eccf9bb7f10bd5c9ac0259ee1b03f2e25fb7a1 (patch)
tree0d1765f2eaf8d6d46727251fafc62bb37971eebf
parent172fcd9600e13d5365f5cf648105891ff6a0e59d (diff)
downloadllvm-d2eccf9bb7f10bd5c9ac0259ee1b03f2e25fb7a1.zip
llvm-d2eccf9bb7f10bd5c9ac0259ee1b03f2e25fb7a1.tar.gz
llvm-d2eccf9bb7f10bd5c9ac0259ee1b03f2e25fb7a1.tar.bz2
[libc++] NFC: Add regression tests for some <tuple> PRs that have been fixed
-rw-r--r--libcxx/test/std/utilities/tuple/tuple.tuple/PR27375.pass.cpp19
-rw-r--r--libcxx/test/std/utilities/tuple/tuple.tuple/PR38601.pass.cpp31
2 files changed, 50 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/PR27375.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/PR27375.pass.cpp
new file mode 100644
index 0000000..8560313
--- /dev/null
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/PR27375.pass.cpp
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Regression test for https://llvm.org/PR27375
+
+// UNSUPPORTED: c++03
+
+#include <tuple>
+
+int main(int, char**) {
+ std::tuple<int&>(std::tuple<int&&>(42));
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/PR38601.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/PR38601.pass.cpp
new file mode 100644
index 0000000..7fb0e89
--- /dev/null
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/PR38601.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Regression test for https://llvm.org/PR38601
+
+// UNSUPPORTED: c++03
+
+#include <cassert>
+#include <tuple>
+
+using Base = std::tuple<int, int>;
+
+struct Derived : Base {
+ template <class ...Ts>
+ Derived(int x, Ts... ts): Base(ts...), x_(x) { }
+ operator int () const { return x_; }
+ int x_;
+};
+
+int main() {
+ Derived d(1, 2, 3);
+ Base b = static_cast<Base>(d);
+ assert(std::get<0>(b) == 2);
+ assert(std::get<1>(b) == 3);
+ return 0;
+}