diff --git a/include/cpp2util.h b/include/cpp2util.h index cffd93ac97..791f347fcf 100644 --- a/include/cpp2util.h +++ b/include/cpp2util.h @@ -1348,6 +1348,9 @@ auto as(X const& x CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT) -> decltype(auto) { } return C{x}; } + else if constexpr (!std::is_reference_v && std::is_same_v && !std::is_same_v) { + return std::any_cast( x ); + } else { return nonesuch; }