Skip to content

Commit eb4e00a

Browse files
committed
clang demands more strictness on compile time exps
1 parent cd5b199 commit eb4e00a

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

cpp/include/coconext/types/signed.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class Signed : public SignedTag {
111111

112112
template <Range R2>
113113
explicit(size() < R2.length()) constexpr Signed(Signed<R2> const& other) {
114-
if constexpr (size() >= other.size()) {
114+
if constexpr (R.length() >= R2.length()) {
115115
value_ = resize<size()>(other).value_;
116116
} else {
117117
value_ = resize<size()>(other).value_;
@@ -413,10 +413,10 @@ class Signed : public SignedTag {
413413
}
414414
safe_shift = static_cast<size_t>(shift_amount);
415415
} else if constexpr (detail::is_coconext_unsigned<CleanType>::value) {
416-
static_assert(shift_amount.size() < 64, "Bit Width cap 2**64");
416+
static_assert(CleanType::size() < 64, "Bit Width cap 2**64");
417417
safe_shift = static_cast<size_t>(static_cast<unsigned long long>(shift_amount));
418418
} else if constexpr (detail::is_coconext_signed<CleanType>::value) {
419-
static_assert(shift_amount.size() < 64, "Bit Width cap 2**64");
419+
static_assert(CleanType::size() < 64, "Bit Width cap 2**64");
420420
long long signed_val = static_cast<long long>(shift_amount);
421421
if (signed_val < 0) {
422422
if consteval {
@@ -459,10 +459,10 @@ class Signed : public SignedTag {
459459
}
460460
safe_shift = static_cast<size_t>(shift_amount);
461461
} else if constexpr (detail::is_coconext_unsigned<CleanType>::value) {
462-
static_assert(shift_amount.size() < 64, "Bit Width cap 2**64");
462+
static_assert(CleanType::size() < 64, "Bit Width cap 2**64");
463463
safe_shift = static_cast<size_t>(static_cast<unsigned long long>(shift_amount));
464464
} else if constexpr (detail::is_coconext_signed<CleanType>::value) {
465-
static_assert(shift_amount.size() < 64, "Bit Width cap 2**64");
465+
static_assert(CleanType::size() < 64, "Bit Width cap 2**64");
466466
long long signed_val = static_cast<long long>(shift_amount);
467467
if (signed_val < 0) {
468468
if consteval {
@@ -539,7 +539,7 @@ class Signed : public SignedTag {
539539

540540
template <Range R2>
541541
constexpr auto operator%(Signed<R2> const& rhs) const {
542-
constexpr size_t W_calc = std::max(size(), rhs.size());
542+
constexpr size_t W_calc = std::max(R.length(), R2.length());
543543
if (!static_cast<bool>(rhs)) {
544544
throw std::domain_error("Division by zero");
545545
}

cpp/include/coconext/types/unsigned.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class Unsigned : public UnsignedTag {
9595
// Cross-width conversion. Throws if the source value doesn't fit in N bits.
9696
template <Range R2>
9797
explicit(size() < R2.length()) constexpr Unsigned(Unsigned<R2> const& other) {
98-
if constexpr (size() >= other.size()) {
98+
if constexpr (R.length() >= R2.length()) {
9999
value_ = other.value_;
100100
} else {
101101
if constexpr (!detail::Bits<size()>::is_not_native_int) {
@@ -384,10 +384,10 @@ class Unsigned : public UnsignedTag {
384384
}
385385
safe_shift = static_cast<size_t>(shift_amount);
386386
} else if constexpr (detail::is_coconext_unsigned<CleanType>::value) {
387-
static_assert(shift_amount.size() < 64, "Bit Width cap 2**64");
387+
static_assert(CleanType::size() < 64, "Bit Width cap 2**64");
388388
safe_shift = static_cast<size_t>(static_cast<unsigned long long>(shift_amount));
389389
} else if constexpr (detail::is_coconext_signed<CleanType>::value) {
390-
static_assert(shift_amount.size() < 64, "Bit Width cap 2**64");
390+
static_assert(CleanType::size() < 64, "Bit Width cap 2**64");
391391
long long signed_val = static_cast<long long>(shift_amount);
392392
if (signed_val < 0) {
393393
if consteval {
@@ -432,10 +432,10 @@ class Unsigned : public UnsignedTag {
432432
}
433433
safe_shift = static_cast<size_t>(shift_amount);
434434
} else if constexpr (detail::is_coconext_unsigned<CleanType>::value) {
435-
static_assert(shift_amount.size() < 64, "Bit Width cap 2**64");
435+
static_assert(CleanType::size() < 64, "Bit Width cap 2**64");
436436
safe_shift = static_cast<size_t>(static_cast<unsigned long long>(shift_amount));
437437
} else if constexpr (detail::is_coconext_signed<CleanType>::value) {
438-
static_assert(shift_amount.size() < 64, "Bit Width cap 2**64");
438+
static_assert(CleanType::size() < 64, "Bit Width cap 2**64");
439439
long long signed_val = static_cast<long long>(shift_amount);
440440
if (signed_val < 0) {
441441
if consteval {
@@ -527,7 +527,7 @@ class Unsigned : public UnsignedTag {
527527

528528
template <Range R2>
529529
constexpr auto operator%(Unsigned<R2> const& rhs) const {
530-
constexpr size_t W_calc = std::max(size(), rhs.size());
530+
constexpr size_t W_calc = std::max(R.length(), R2.length());
531531

532532
if (!static_cast<bool>(rhs)) {
533533
if consteval {

0 commit comments

Comments
 (0)