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

Skip trivial-copyability Expected expectations under gcc49

Summary:
[Folly] Skip trivial-copyability `Expected` expectations under gcc49.

The focus is on gcc5+; all that is needed for now is to keep code compiling with gcc49, but not necessarily to ensure optimal trivial-copyability behavior.

Reviewed By: Orvid

Differential Revision: D8364392

fbshipit-source-id: b0062193c844509b6bf26ed632dd8e5d4bdf77d2
parent 544a8c33
......@@ -612,6 +612,9 @@ struct WithConstructor {
WithConstructor();
};
// libstdc++ with GCC 4.x doesn't have std::is_trivially_copyable
#if (defined(__clang__) && !defined(_LIBCPP_VERSION)) || \
!(defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5)
TEST(Expected, TriviallyCopyable) {
// These could all be static_asserts but EXPECT_* give much nicer output on
// failure.
......@@ -627,15 +630,12 @@ TEST(Expected, TriviallyCopyable) {
(is_trivially_copyable<Expected<std::string, E>>::value));
EXPECT_FALSE(
(is_trivially_copyable<Expected<int, std::string>>::value));
// libstdc++ with GCC 4.x doesn't have std::is_trivially_copyable
#if (defined(__clang__) && !defined(_LIBCPP_VERSION)) || \
!(defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5)
EXPECT_TRUE(
(is_trivially_copyable<Expected<WithConstructor, E>>::value));
#endif
EXPECT_TRUE(
(is_trivially_copyable<Expected<Expected<int, E>, E>>::value));
}
#endif
TEST(Expected, Then) {
// Lifting
......
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