Commit c6061900 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Fix incorrect forward_tuple test

Summary:
[Folly] Fix incorrect `forward_tuple` test which only passes with libc++ < 3.8 and libstdc++ < 8.

The test would fail with libc++ >= 3.8 and with libstdc++ >= 8.

Spec fix in: https://cplusplus.github.io/LWG/issue2485.
Upstream libc++ fix in: https://github.com/llvm-mirror/libcxx/commit/199bee0ea7750b8e96a25414c3c2a7b465336e36.
Upstream libstdc++ fix in: https://github.com/gcc-mirror/gcc/commit/6d8efcd444067c046d72ac8e11737230f031a031.

Closes #1078.

Reviewed By: pixelb

Differential Revision: D14590323

fbshipit-source-id: ff023ab844d5da97e83f09576897304ac06678b8
parent acd6334f
...@@ -575,10 +575,18 @@ TEST(ForwardTuple, Basic) { ...@@ -575,10 +575,18 @@ TEST(ForwardTuple, Basic) {
decltype(folly::forward_tuple(std::move(tuple))), decltype(folly::forward_tuple(std::move(tuple))),
std::tuple<int&&, double&&>>::value)); std::tuple<int&&, double&&>>::value));
EXPECT_EQ(folly::forward_tuple(std::move(tuple)), tuple); EXPECT_EQ(folly::forward_tuple(std::move(tuple)), tuple);
#if defined(__GLIBCXX__) && (!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < 8)
constexpr bool before_lwg2485 = true;
#else
constexpr bool before_lwg2485 = false;
#endif
EXPECT_TRUE( EXPECT_TRUE(
(std::is_same< (std::is_same<
decltype(folly::forward_tuple(std::move(folly::as_const(tuple)))), decltype(folly::forward_tuple(std::move(folly::as_const(tuple)))),
std::tuple<const int&, const double&>>::value)); std::conditional_t<
before_lwg2485,
std::tuple<const int&, const double&>,
std::tuple<const int&&, const double&&>>>::value));
EXPECT_EQ(folly::forward_tuple(std::move(folly::as_const(tuple))), tuple); EXPECT_EQ(folly::forward_tuple(std::move(folly::as_const(tuple))), tuple);
auto integer = 1; auto integer = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment