From cc27d851101b962518fac1dfbe0fc82dd893866c 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 --- yoga/YGLayout.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/yoga/YGLayout.h b/yoga/YGLayout.h index 1b30cc8c..74082a76 100644 --- a/yoga/YGLayout.h +++ b/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();