This is an automated email from the ASF dual-hosted git repository.
gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git
The following commit(s) were added to refs/heads/main by this push:
new d6458025 fix: make static_assert template-dependent in ByteSwap (#464)
d6458025 is described below
commit d6458025719278d3dfda61b95dab3792df72e18b
Author: Xinli Shang <[email protected]>
AuthorDate: Tue Dec 30 16:29:29 2025 -0800
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.
---
src/iceberg/util/endian.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/iceberg/util/endian.h b/src/iceberg/util/endian.h
index 30c38bae..52fa93e6 100644
--- a/src/iceberg/util/endian.h
+++ b/src/iceberg/util/endian.h
@@ -48,7 +48,8 @@ constexpr T ByteSwap(T value) {
} else if constexpr (sizeof(T) == sizeof(uint64_t)) {
return std::bit_cast<T>(std::byteswap(std::bit_cast<uint64_t>(value)));
} else {
- static_assert(false, "Unsupported floating-point size for endian
conversion.");
+ static_assert(sizeof(T) == 0,
+ "Unsupported floating-point size for endian conversion.");
}
}
}