From 079f73cc5c6413127d47f325cbb34a607e2cb030 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Fri, 16 Dec 2022 22:58:51 +0100 Subject: [PATCH] Workaround gcc 11 limitation For some reason, gcc sees a constexpr violation here. Trust clang and msvc on this. --- include/frozen/unordered_set.h | 2 +- tests/test_unordered_set.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/frozen/unordered_set.h b/include/frozen/unordered_set.h index 4d16df9..196ea50 100644 --- a/include/frozen/unordered_set.h +++ b/include/frozen/unordered_set.h @@ -105,7 +105,7 @@ class unordered_set { /* lookup */ template constexpr std::size_t count(KeyType const &key, Hasher const &hash, Equal const &equal) const { - auto const k = lookup(key, hash); + auto const & k = lookup(key, hash); return equal(k, key); } template diff --git a/tests/test_unordered_set.cpp b/tests/test_unordered_set.cpp index e90a0d4..042c1a8 100644 --- a/tests/test_unordered_set.cpp +++ b/tests/test_unordered_set.cpp @@ -65,7 +65,7 @@ TEST_CASE("tripleton str frozen unordered set", "[unordered set]") { constexpr auto max_size = ze_set.max_size(); REQUIRE(max_size == 3); - constexpr auto nocount = ze_set.count(4); + const auto nocount = ze_set.count(4); REQUIRE(nocount == 0); constexpr auto count = ze_set.count(1);