Commit 1d2790bc authored by Louis Brandy's avatar Louis Brandy Committed by Facebook Github Bot

make UtilityTest compile with c++17.

Summary:
C++17 actually removes this overload of `std::addressof` to avoid taking the address of constants. It's not clear to me that the second test here is actually adding much value here.

See (2) at: https://en.cppreference.com/w/cpp/memory/addressof

Reviewed By: yfeldblum, elsteveogrande

Differential Revision: D8775544

fbshipit-source-id: a42209484574509f4d032ebbdf05430f0ed372c4
parent 1e877625
......@@ -77,12 +77,17 @@ TEST_F(UtilityTest, as_const) {
EXPECT_TRUE(noexcept(folly::as_const(s)));
}
template <typename T>
static T& as_mutable(T const& t) {
return const_cast<T&>(t);
}
TEST_F(UtilityTest, forward_like) {
int x = 0;
// just show that it may be invoked, and that it is purely a cast
// the real work is done by like_t, in terms of which forward_like is defined
EXPECT_EQ(&x, std::addressof(folly::forward_like<char&>(x)));
EXPECT_EQ(&x, std::addressof(folly::forward_like<char const>(x)));
EXPECT_EQ(&x, std::addressof(as_mutable(folly::forward_like<char const>(x))));
}
TEST_F(UtilityTest, exchange) {
......
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