[PATCH] D14839: [libcxx] LWG2485: get() should be overloaded for const tuple&&

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 14 19:47:36 PST 2015


EricWF added a comment.

LGTM after the requested changes. Thanks.


================
Comment at: test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.fail.cpp:30
@@ +29,3 @@
+    {
+        cref(std::get<0>(tup4()));  // expected-error {{call to deleted function 'cref'}}
+    }
----------------
Could you add a comment about why this test is important? On it's face it looks a little silly but it's really the rational for this entire change.



================
Comment at: test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.pass.cpp:25
@@ +24,3 @@
+#include <cassert>
+
+int main()
----------------
#include "test_macros.h"

================
Comment at: test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.pass.cpp:50
@@ +49,3 @@
+    int const y = 43;
+    std::tuple<int&, int const&> const p(x, y);
+    static_assert(std::is_same<int&, decltype(std::get<0>(std::move(p)))>::value, "");
----------------
Test for `int&&` and `int const&&` as well please.

================
Comment at: test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp:21
@@ -19,3 +20,3 @@
 {
 #if _LIBCPP_STD_VER > 11
     typedef std::complex<float> cf;
----------------
You can remove this guard. The test is already supported for C++11 and earlier.

================
Comment at: test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp:71
@@ +70,3 @@
+    int tuple y = 43;
+    std::tuple<int&, int const&> const t(x, y);
+    static_assert(std::is_same<int&, decltype(std::get<int&>(std::move(t)))>::value, "");
----------------
Same as above: Rvalue ref tests.

================
Comment at: test/std/utilities/utility/pairs/pair.astuple/get_const_rv.pass.cpp:38
@@ +37,3 @@
+    int const y = 43;
+    std::pair<int&, int const&> const p(x, y);
+    static_assert(std::is_same<int&, decltype(std::get<0>(std::move(p)))>::value, "");
----------------
Same as above: Rvalue ref tests.

================
Comment at: test/std/utilities/utility/pairs/pair.astuple/pairs.by.type.pass.cpp:59
@@ +58,3 @@
+    int const y = 43;
+    std::pair<int&, int const&> const p(x, y);
+    static_assert(std::is_same<int&, decltype(std::get<int&>(std::move(p)))>::value, "");
----------------
rvalue ref tests please.


http://reviews.llvm.org/D14839





More information about the cfe-commits mailing list