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

Fix Build: folly with -Wmissing-braces

Summary:
[Folly] Fix Build: `folly` with `-Wmissing-braces`.

Construction of `std::array` with list-initialization for the contained C array requires double braces, per the standard.

Compilers accept it with single braces, but will reject it when `-Wmissing-braces` is passed.

Reviewed By: igorsugak, meyering

Differential Revision: D4202629

fbshipit-source-id: e5b87a655e7f25e6cddb931dda28b172c768f227
parent 7b77a513
...@@ -53,7 +53,7 @@ template <typename D = void, typename... TList> ...@@ -53,7 +53,7 @@ template <typename D = void, typename... TList>
constexpr array_detail::return_type<D, TList...> make_array(TList&&... t) { constexpr array_detail::return_type<D, TList...> make_array(TList&&... t) {
using value_type = using value_type =
typename array_detail::return_type_helper<D, TList...>::type; typename array_detail::return_type_helper<D, TList...>::type;
return {static_cast<value_type>(std::forward<TList>(t))...}; return {{static_cast<value_type>(std::forward<TList>(t))...}};
} }
} // !folly } // !folly
...@@ -620,7 +620,7 @@ TEST(Future, finishBigLambda) { ...@@ -620,7 +620,7 @@ TEST(Future, finishBigLambda) {
// bulk_data, to be captured in the lambda passed to Future::then. // bulk_data, to be captured in the lambda passed to Future::then.
// This is meant to force that the lambda can't be stored inside // This is meant to force that the lambda can't be stored inside
// the Future object. // the Future object.
std::array<char, sizeof(detail::Core<int>)> bulk_data = {0}; std::array<char, sizeof(detail::Core<int>)> bulk_data = {{0}};
// suppress gcc warning about bulk_data not being used // suppress gcc warning about bulk_data not being used
EXPECT_EQ(bulk_data[0], 0); EXPECT_EQ(bulk_data[0], 0);
......
...@@ -1111,7 +1111,7 @@ TEST(RangeFunc, ConstexprCArray) { ...@@ -1111,7 +1111,7 @@ TEST(RangeFunc, ConstexprCArray) {
} }
TEST(RangeFunc, ConstexprStdArray) { TEST(RangeFunc, ConstexprStdArray) {
static constexpr const std::array<int, 4> numArray = {3, 17, 1, 9}; static constexpr const std::array<int, 4> numArray = {{3, 17, 1, 9}};
constexpr const auto numArrayRange = range(numArray); constexpr const auto numArrayRange = range(numArray);
EXPECT_EQ(17, numArrayRange[1]); EXPECT_EQ(17, numArrayRange[1]);
constexpr const auto numArrayRangeSize = numArrayRange.size(); constexpr const auto numArrayRangeSize = numArrayRange.size();
......
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