Skip to content

Commit

Permalink
Make sure Variant's value constructor doesn't shadow move constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Glebocki committed May 10, 2022
1 parent 121e80b commit 818c6b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/util/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ class Variant {
constexpr Variant(Variant&& other) noexcept { Construct(std::move(other)); }

// TODO(mglb): enable conditionally
template <class T, std::enable_if_t<type_list_contains_v<T>>* = nullptr>
template <class T,
std::enable_if_t<!std::is_same_v<Variant, remove_cvref_t<T>> &&
type_list_contains_v<T>>* = nullptr>
constexpr explicit Variant(T&& obj) noexcept {
Construct(std::forward<T>(obj));
}
Expand Down

0 comments on commit 818c6b4

Please sign in to comment.