Skip to content

Commit 4b6eb91

Browse files
committed
fix: safe_int_test fixed for freestanding
1 parent bb6a174 commit 4b6eb91

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/static/safe_int_test.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ import std;
3434
#include <concepts>
3535
#include <cstdint>
3636
#include <limits>
37-
#include <string>
3837
#include <type_traits>
38+
#if MP_UNITS_HOSTED
39+
#include <string>
40+
#endif
3941
#endif
4042

4143
namespace {
@@ -130,8 +132,10 @@ static_assert(is_value_preserving_int_v<constrained<short, test_policy>, safe_in
130132
static_assert(!is_value_preserving_int_v<constrained<int, test_policy>, safe_int<short>>);
131133

132134
// Types without numeric_limits: always false
135+
#if MP_UNITS_HOSTED
133136
static_assert(!is_value_preserving_int_v<std::string, int>);
134137
static_assert(!is_value_preserving_int_v<int, std::string>);
138+
#endif
135139

136140
// ============================================================================
137141
// is_value_preserving_v — generalized: delegates to is_value_preserving_int_v
@@ -149,8 +153,10 @@ static_assert(is_value_preserving_v<safe_int<short>, safe_int<int>>);
149153
static_assert(!is_value_preserving_v<safe_int<int>, safe_int<short>>);
150154

151155
// Non-numeric_limits types: falls back to is_convertible_v
156+
#if MP_UNITS_HOSTED
152157
static_assert(!is_value_preserving_v<std::string, int>); // not convertible
153158
static_assert(!is_value_preserving_v<int, std::string>); // not convertible
159+
#endif
154160

155161
// ============================================================================
156162
// treat_as_floating_point: must be false

0 commit comments

Comments
 (0)