Skip to content

Commit a831a1a

Browse files
fix: Add missing #include <string> and update common_rep logic
1 parent d60372f commit a831a1a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/policy/impl.cppm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
module;
2-
#include <string>
32
#include <concepts>
43
#include <exception>
54
#include <expected>
65
#include <stdexcept>
6+
#include <string>
77
#include <type_traits>
88

9+
910
export module mcpplibs.primitives.policy.impl;
1011

1112
import mcpplibs.primitives.operations.traits;
@@ -149,6 +150,7 @@ struct type::handler<type::compatible, OpTag, LhsRep, RhsRep> {
149150
static constexpr bool enabled = true;
150151
static constexpr bool allowed =
151152
std::is_arithmetic_v<LhsRep> && std::is_arithmetic_v<RhsRep> &&
153+
has_common_rep<LhsRep, RhsRep> &&
152154
!details::rejects_arithmetic_for_boolean_or_character_v<OpTag, LhsRep,
153155
RhsRep>;
154156
static constexpr unsigned diagnostic_id =
@@ -157,17 +159,19 @@ struct type::handler<type::compatible, OpTag, LhsRep, RhsRep> {
157159
? 3u
158160
: (allowed ? 0u : 2u);
159161
using common_rep =
160-
std::conditional_t<allowed, std::common_type_t<LhsRep, RhsRep>, void>;
162+
std::conditional_t<allowed, common_rep_t<LhsRep, RhsRep>, void>;
161163
};
162164

163165
template <operations::operation OpTag, typename LhsRep, typename RhsRep>
164166
struct type::handler<type::transparent, OpTag, LhsRep, RhsRep> {
165167
static constexpr bool enabled = true;
166168
static constexpr bool allowed =
169+
has_common_rep<LhsRep, RhsRep> &&
167170
!details::rejects_arithmetic_for_boolean_or_character_v<OpTag, LhsRep,
168171
RhsRep>;
169172
static constexpr unsigned diagnostic_id = allowed ? 0u : 3u;
170-
using common_rep = std::common_type_t<LhsRep, RhsRep>;
173+
using common_rep =
174+
std::conditional_t<allowed, common_rep_t<LhsRep, RhsRep>, void>;
171175
};
172176

173177
template <operations::operation OpTag, typename CommonRep,

0 commit comments

Comments
 (0)