Skip to content

Commit d645802

Browse files
authored
fix: make static_assert template-dependent in ByteSwap (#464)
The static_assert(false, ...) in the ByteSwap function template was unconditionally evaluated at template definition time, which could cause compilation failures even when the else branch is never instantiated.
1 parent cf0fd37 commit d645802

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/iceberg/util/endian.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ constexpr T ByteSwap(T value) {
4848
} else if constexpr (sizeof(T) == sizeof(uint64_t)) {
4949
return std::bit_cast<T>(std::byteswap(std::bit_cast<uint64_t>(value)));
5050
} else {
51-
static_assert(false, "Unsupported floating-point size for endian conversion.");
51+
static_assert(sizeof(T) == 0,
52+
"Unsupported floating-point size for endian conversion.");
5253
}
5354
}
5455
}

0 commit comments

Comments
 (0)