Skip to content

Commit bd129b4

Browse files
committed
Try to fix clang compiler error.
1 parent 959f977 commit bd129b4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

include/cpp2util.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,8 @@ constexpr auto is( X const& x ) -> auto
20122012
}
20132013

20142014

2015-
inline constexpr auto is( specialization_of_template<std::variant> auto const& x, auto&& value ) -> bool
2015+
template <specialization_of_template<std::variant> X>
2016+
inline constexpr auto is( X const& x, auto&& value ) -> bool
20162017
{
20172018
return type_find_if(x, [&]<typename It>(It const&) -> bool {
20182019
if (x.index() == It::index) {
@@ -2026,16 +2027,16 @@ inline constexpr auto is( specialization_of_template<std::variant> auto const& x
20262027
}) != std::variant_npos;
20272028
}
20282029

2029-
template< typename C >
2030-
auto as(specialization_of_template<std::variant> auto&& x CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT_AS) -> decltype(auto)
2030+
template< typename C, specialization_of_template<std::variant> X >
2031+
auto as( X&& x CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT_AS) -> decltype(auto)
20312032
{
2032-
constness_like_t<C, decltype(x)>* ptr = nullptr;
2033+
constness_like_t<C, X>* ptr = nullptr;
20332034
type_find_if(CPP2_FORWARD(x), [&]<typename It>(It const&) -> bool {
20342035
if constexpr (std::is_same_v< typename It::type, C >) { if (CPP2_FORWARD(x).index() == It::index) { ptr = &std::get<It::index>(x); return true; } };
20352036
return false;
20362037
});
20372038
if (!ptr) { Throw( std::bad_variant_access(), "'as' cast failed for 'variant'"); }
2038-
return cpp2::forward_like<decltype(x)>(*ptr);
2039+
return cpp2::forward_like<X>(*ptr);
20392040
}
20402041

20412042
//-------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)