From 23e052f9353faf71155f36ec70b10f73d56a4ff4 Mon Sep 17 00:00:00 2001 From: Martin Ankerl Date: Thu, 16 Jan 2020 22:50:15 +0100 Subject: [PATCH] fix windows build --- .../unit/unit_undefined_behavior_nekrolm.cpp | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/test/unit/unit_undefined_behavior_nekrolm.cpp b/src/test/unit/unit_undefined_behavior_nekrolm.cpp index 598231bd..cf55339f 100644 --- a/src/test/unit/unit_undefined_behavior_nekrolm.cpp +++ b/src/test/unit/unit_undefined_behavior_nekrolm.cpp @@ -48,7 +48,7 @@ struct IntegralState { return value == other.value; } - inline size_t Hash() const noexcept { + ROBIN_HOOD(NODISCARD) inline size_t Hash() const noexcept { static const robin_hood::hash hasher; return hasher(value); } @@ -67,10 +67,10 @@ struct StatePair { : first_state(f) , second_state(s) {} - inline const First& FirstState() const noexcept { + ROBIN_HOOD(NODISCARD) inline const First& FirstState() const noexcept { return first_state; } - inline const Second& SecondState() const noexcept { + ROBIN_HOOD(NODISCARD) inline const Second& SecondState() const noexcept { return second_state; } @@ -83,7 +83,7 @@ struct StatePair { : first_state < other.first_state; } - inline size_t Hash() const noexcept { + ROBIN_HOOD(NODISCARD) inline size_t Hash() const noexcept { return CombineHashes(second_state.Hash(), first_state.Hash()); } }; @@ -102,7 +102,7 @@ struct StatePair { inline StatePair(First f, VoidState ROBIN_HOOD_UNUSED(x) /*unused*/) noexcept : first_state(std::move(f)) {} - inline const First& FirstState() const noexcept { + ROBIN_HOOD(NODISCARD) inline const First& FirstState() const noexcept { return first_state; } inline static VoidState SecondState() noexcept { @@ -117,7 +117,7 @@ struct StatePair { return first_state < other.first_state; } - inline size_t Hash() const noexcept { + ROBIN_HOOD(NODISCARD) inline size_t Hash() const noexcept { return first_state.Hash(); } }; @@ -128,7 +128,7 @@ struct StatePair { Second second_state{}; public: - inline StatePair(VoidState ROBIN_HOOD_UNUSED(x) /*unused*/, Second s) noexcept + explicit inline StatePair(VoidState ROBIN_HOOD_UNUSED(x) /*unused*/, Second s) noexcept : second_state(std::move(s)) {} inline StatePair() noexcept = default; @@ -148,7 +148,7 @@ struct StatePair { return second_state < other.second_state; } - inline size_t Hash() const noexcept { + ROBIN_HOOD(NODISCARD) inline size_t Hash() const noexcept { return second_state.Hash(); } }; @@ -181,7 +181,7 @@ class FstStatePair { : inner_state < other.inner_state; } - size_t Hash() const noexcept { + ROBIN_HOOD(NODISCARD) size_t Hash() const noexcept { static const robin_hood::hash hasher; return hasher((static_cast(inner_state) << 32U) | static_cast(outer_state)); @@ -208,7 +208,9 @@ TEST_CASE_TEMPLATE("undefined_behavior_nekrolm", Map, robin_hood::unordered_flat for (int i = 0; i < 1000; ++i) { for (int j = 0; j < 1000; ++j) { - IState s = {{i, j}, FState{}}; + FstStatePair lhs(i, j); + FState rhs{}; + IState s(lhs, rhs); map[s] = static_cast(map.size()); } }