[libcxx-commits] [libcxx] d2eccf9 - [libc++] NFC: Add regression tests for some <tuple> PRs that have been fixed

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 8 09:17:23 PDT 2021


Author: Louis Dionne
Date: 2021-06-08T12:17:10-04:00
New Revision: d2eccf9bb7f10bd5c9ac0259ee1b03f2e25fb7a1

URL: https://github.com/llvm/llvm-project/commit/d2eccf9bb7f10bd5c9ac0259ee1b03f2e25fb7a1
DIFF: https://github.com/llvm/llvm-project/commit/d2eccf9bb7f10bd5c9ac0259ee1b03f2e25fb7a1.diff

LOG: [libc++] NFC: Add regression tests for some <tuple> PRs that have been fixed

Added: 
    libcxx/test/std/utilities/tuple/tuple.tuple/PR27375.pass.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/PR38601.pass.cpp

Modified: 
    

Removed: 
    


################################################################################
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 0000000000000..8560313bfca7f
--- /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 0000000000000..7fb0e8904df57
--- /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;
+}


        


More information about the libcxx-commits mailing list