Skip to content

Commit eb2609c

Browse files
committed
Fix tests
1 parent 4755e81 commit eb2609c

21 files changed

+40
-39
lines changed

include/cpp2util.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,8 @@ constexpr auto is( X const& x ) -> auto
20272027
}
20282028

20292029

2030-
inline constexpr auto is( specialization_of_template<std::variant> auto const& x, auto&& value ) -> bool
2030+
template <specialization_of_template<std::variant> X>
2031+
inline constexpr auto is( X const& x, auto&& value ) -> bool
20312032
{
20322033
return type_find_if(x, [&]<typename It>(It const&) -> bool {
20332034
if (x.index() == It::index) {
@@ -2041,16 +2042,16 @@ inline constexpr auto is( specialization_of_template<std::variant> auto const& x
20412042
}) != std::variant_npos;
20422043
}
20432044

2044-
template< typename C >
2045-
auto as(specialization_of_template<std::variant> auto&& x CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT_AS) -> decltype(auto)
2045+
template< typename C, specialization_of_template<std::variant> X >
2046+
auto as( X&& x CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT_AS) -> decltype(auto)
20462047
{
2047-
constness_like_t<C, decltype(x)>* ptr = nullptr;
2048+
constness_like_t<C, X>* ptr = nullptr;
20482049
type_find_if(CPP2_FORWARD(x), [&]<typename It>(It const&) -> bool {
20492050
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; } };
20502051
return false;
20512052
});
20522053
if (!ptr) { Throw( std::bad_variant_access(), "'as' cast failed for 'variant'"); }
2053-
return cpp2::forward_like<decltype(x)>(*ptr);
2054+
return cpp2::forward_like<X>(*ptr);
20542055
}
20552056

20562057
//-------------------------------------------------------------------------------------------------------------
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../include/cpp2util.h(1068) decltype(auto) cpp2::impl::assert_in_bounds(auto &&, std::source_location) [arg = 5, x:auto = std::vector<int>]: Bounds safety violation: out of bounds access attempt detected - attempted access at index 5, [min,max] range is [0,4]
1+
../../../include/cpp2util.h(1066) decltype(auto) cpp2::impl::assert_in_bounds(auto &&, std::source_location) [arg = 5, x:auto = std::vector<int>]: Bounds safety violation: out of bounds access attempt detected - attempted access at index 5, [min,max] range is [0,4]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../include/cpp2util.h(880) : Bounds safety violation
1+
../../../include/cpp2util.h(878) : Bounds safety violation
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../include/cpp2util.h(880) : Contract violation: fill: value must contain at least count elements
1+
../../../include/cpp2util.h(878) : Contract violation: fill: value must contain at least count elements
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
sending error to my framework... [dynamic null dereference attempt detected]
2-
from source location: ../../../include/cpp2util.h(959) decltype(auto) cpp2::impl::assert_not_null(auto &&, std::source_location) [arg:auto = int *&]
2+
from source location: ../../../include/cpp2util.h(957) decltype(auto) cpp2::impl::assert_not_null(auto &&, std::source_location) [arg:auto = int *&]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../include/cpp2util.h(959) decltype(auto) cpp2::impl::assert_not_null(auto &&, std::source_location) [arg:auto = std::expected<int, bool>]: Null safety violation: std::expected has an unexpected value
1+
../../../include/cpp2util.h(957) decltype(auto) cpp2::impl::assert_not_null(auto &&, std::source_location) [arg:auto = std::expected<int, bool>]: Null safety violation: std::expected has an unexpected value
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../include/cpp2util.h(959) decltype(auto) cpp2::impl::assert_not_null(auto &&, std::source_location) [arg:auto = std::optional<int>]: Null safety violation: std::optional does not contain a value
1+
../../../include/cpp2util.h(957) decltype(auto) cpp2::impl::assert_not_null(auto &&, std::source_location) [arg:auto = std::optional<int>]: Null safety violation: std::optional does not contain a value
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../include/cpp2util.h(959) decltype(auto) cpp2::impl::assert_not_null(auto &&, std::source_location) [arg:auto = std::shared_ptr<int>]: Null safety violation: std::shared_ptr is empty
1+
../../../include/cpp2util.h(957) decltype(auto) cpp2::impl::assert_not_null(auto &&, std::source_location) [arg:auto = std::shared_ptr<int>]: Null safety violation: std::shared_ptr is empty
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../include/cpp2util.h(959) decltype(auto) cpp2::impl::assert_not_null(auto &&, std::source_location) [arg:auto = std::unique_ptr<int>]: Null safety violation: std::unique_ptr is empty
1+
../../../include/cpp2util.h(957) decltype(auto) cpp2::impl::assert_not_null(auto &&, std::source_location) [arg:auto = std::unique_ptr<int>]: Null safety violation: std::unique_ptr is empty
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../../include/cpp2util.h(1068) decltype(auto) cpp2::impl::assert_in_bounds(auto &&, std::source_location) [arg = 5, x:auto = std::vector<int>]: Bounds safety violation: out of bounds access attempt detected - attempted access at index 5, [min,max] range is [0,4]
1+
../../../include/cpp2util.h(1066) decltype(auto) cpp2::impl::assert_in_bounds(auto &&, std::source_location) [arg = 5, x:auto = std::vector<int>]: Bounds safety violation: out of bounds access attempt detected - attempted access at index 5, [min,max] range is [0,4]

0 commit comments

Comments
 (0)