Skip to content

Commit 7e6f34b

Browse files
authored
Fix for C++23 implicit move (#1838)
1 parent a33616b commit 7e6f34b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/test_utils.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ constexpr void has_type(Actual &&)
130130
static_assert(std::is_same<Expected, Actual>::value, "Not the same");
131131
}
132132

133-
template<ranges::cardinality Expected,
134-
typename Rng,
133+
template<ranges::cardinality Expected,
134+
typename Rng,
135135
ranges::cardinality Actual = ranges::range_cardinality<Rng>::value>
136136
constexpr void has_cardinality(Rng &&)
137137
{
@@ -141,7 +141,7 @@ constexpr void has_cardinality(Rng &&)
141141
template<typename T>
142142
constexpr T & as_lvalue(T && t)
143143
{
144-
return t;
144+
return static_cast<T&>(t); // prevent C++23 implicit move (plain `t` is move-eligible)
145145
}
146146

147147
// A simple, light-weight, non-owning reference to a type-erased function.

0 commit comments

Comments
 (0)