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

Fix UBSAN failure in RangeTest.cpp with libstdc++-v4.9

Summary:
[Folly] Fix UBSAN failure in `RangeTest.cpp` with `libstdc++-v4.9`.

The implementation of `std::array` in `libstdc++-v4.9` has undefined behavior in the case of the zero-length array - dereferencing (but immediately taking the address again) of `nullptr`. This is fixed in `libstdc++-v5`.

Reviewed By: ot

Differential Revision: D6528614

fbshipit-source-id: 26be6bdc28d9e6dc6e6293a4d4ecffd769c01413
parent b92bbedc
......@@ -1201,7 +1201,7 @@ TEST(CRangeFunc, StdArrayZero) {
auto const numArrayRange = crange(numArray);
EXPECT_TRUE(
(std::is_same<int const*, decltype(numArrayRange)::iterator>::value));
EXPECT_THAT(numArrayRange, testing::ElementsAreArray(numArray));
EXPECT_THAT(numArrayRange, testing::IsEmpty());
}
TEST(CRangeFunc, Collection) {
......
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