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
This commit is contained in:
Uladzislau Paulovich
2019-07-01 08:47:58 -07:00
committed by Facebook Github Bot
parent cd5324378d
commit cc27d85110

View File

@@ -8,12 +8,9 @@
#include "YGFloatOptional.h" #include "YGFloatOptional.h"
#include "Yoga-internal.h" #include "Yoga-internal.h"
constexpr std::array<float, 2> kYGDefaultDimensionValues = {
{YGUndefined, YGUndefined}};
struct YGLayout { struct YGLayout {
std::array<float, 4> position = {}; std::array<float, 4> position = {};
std::array<float, 2> dimensions = kYGDefaultDimensionValues; std::array<float, 2> dimensions = {{YGUndefined, YGUndefined}};
std::array<float, 4> margin = {}; std::array<float, 4> margin = {};
std::array<float, 4> border = {}; std::array<float, 4> border = {};
std::array<float, 4> padding = {}; std::array<float, 4> padding = {};
@@ -33,7 +30,7 @@ struct YGLayout {
uint32_t nextCachedMeasurementsIndex = 0; uint32_t nextCachedMeasurementsIndex = 0;
std::array<YGCachedMeasurement, YG_MAX_CACHED_RESULT_COUNT> std::array<YGCachedMeasurement, YG_MAX_CACHED_RESULT_COUNT>
cachedMeasurements = {}; cachedMeasurements = {};
std::array<float, 2> measuredDimensions = kYGDefaultDimensionValues; std::array<float, 2> measuredDimensions = {{YGUndefined, YGUndefined}};
YGCachedMeasurement cachedLayout = YGCachedMeasurement(); YGCachedMeasurement cachedLayout = YGCachedMeasurement();