[core] Add static_assert for void* / uintptr_t size parity

Ensures the inline Callback storage path is only used on platforms
where void* has no trap representations (all bit patterns valid).
This commit is contained in:
J. Nick Koston
2026-03-15 22:41:15 -10:00
parent 70733fa913
commit 30e6e0a6b7
+4
View File
@@ -1737,6 +1737,10 @@ constexpr float fahrenheit_to_celsius(float value) { return (value - 32.0f) / 1.
template<typename... X> struct Callback;
template<typename... Ts> struct Callback<void(Ts...)> {
// The inline storage path stores callable bytes in ctx via memcpy.
// This requires all bit patterns to be valid for void* (no trap representations).
static_assert(sizeof(void *) == sizeof(std::uintptr_t), "void* must be the same size as uintptr_t");
void (*fn)(void *, Ts...);
void *ctx;