From: Yedidya Feldblum Date: Fri, 18 Nov 2016 07:01:42 +0000 (-0800) Subject: Fix Build: folly with -Wmissing-braces X-Git-Tag: v2016.11.21.00~10 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=005736d3bc1d21fb0415fd68b6233890edc0b31b 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 --- diff --git a/folly/Array.h b/folly/Array.h index 77faafe3..7ca3b6ca 100644 --- a/folly/Array.h +++ b/folly/Array.h @@ -53,7 +53,7 @@ template constexpr array_detail::return_type make_array(TList&&... t) { using value_type = typename array_detail::return_type_helper::type; - return {static_cast(std::forward(t))...}; + return {{static_cast(std::forward(t))...}}; } } // !folly diff --git a/folly/futures/test/FutureTest.cpp b/folly/futures/test/FutureTest.cpp index 8a66184a..7d0275d6 100644 --- a/folly/futures/test/FutureTest.cpp +++ b/folly/futures/test/FutureTest.cpp @@ -620,7 +620,7 @@ TEST(Future, finishBigLambda) { // 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 // the Future object. - std::array)> bulk_data = {0}; + std::array)> bulk_data = {{0}}; // suppress gcc warning about bulk_data not being used EXPECT_EQ(bulk_data[0], 0); diff --git a/folly/test/RangeTest.cpp b/folly/test/RangeTest.cpp index 5861b60f..827e085c 100644 --- a/folly/test/RangeTest.cpp +++ b/folly/test/RangeTest.cpp @@ -1111,7 +1111,7 @@ TEST(RangeFunc, ConstexprCArray) { } TEST(RangeFunc, ConstexprStdArray) { - static constexpr const std::array numArray = {3, 17, 1, 9}; + static constexpr const std::array numArray = {{3, 17, 1, 9}}; constexpr const auto numArrayRange = range(numArray); EXPECT_EQ(17, numArrayRange[1]); constexpr const auto numArrayRangeSize = numArrayRange.size();