From ce9c47f34be90ea9d6f287f97c11af36625f4892 Mon Sep 17 00:00:00 2001 From: Uladzislau Paulovich Date: Mon, 1 Jul 2019 08:47:58 -0700 Subject: [PATCH] Remove incorrect constexpr specifier in YGLayout (#25430) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/25430 Pull Request resolved: https://github.com/facebook/litho/pull/561 Pull Request resolved: https://github.com/facebook/yoga/pull/910 * According to C++ standard values which produce undefined behavior cannot be declared as `constexpr`. * Expressions which evaluate to `nan, infinity, etc` are undefined behavior. For more details you can checkout this Stackoverflow answer: https://stackoverflow.com/a/46373136 Reviewed By: davidaurelio Differential Revision: D16055108 fbshipit-source-id: ee85ba63a714b18bfb8aa8c0770652e184454f74 --- ReactCommon/yoga/yoga/YGLayout.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ReactCommon/yoga/yoga/YGLayout.h b/ReactCommon/yoga/yoga/YGLayout.h index 1b30cc8ce29..74082a7640e 100644 --- a/ReactCommon/yoga/yoga/YGLayout.h +++ b/ReactCommon/yoga/yoga/YGLayout.h @@ -8,12 +8,9 @@ #include "YGFloatOptional.h" #include "Yoga-internal.h" -constexpr std::array kYGDefaultDimensionValues = { - {YGUndefined, YGUndefined}}; - struct YGLayout { std::array position = {}; - std::array dimensions = kYGDefaultDimensionValues; + std::array dimensions = {{YGUndefined, YGUndefined}}; std::array margin = {}; std::array border = {}; std::array padding = {}; @@ -33,7 +30,7 @@ struct YGLayout { uint32_t nextCachedMeasurementsIndex = 0; std::array cachedMeasurements = {}; - std::array measuredDimensions = kYGDefaultDimensionValues; + std::array measuredDimensions = {{YGUndefined, YGUndefined}}; YGCachedMeasurement cachedLayout = YGCachedMeasurement();