diff --git a/cpp/fory/util/result.h b/cpp/fory/util/result.h index 0fa5c91bad..3b326f4579 100644 --- a/cpp/fory/util/result.h +++ b/cpp/fory/util/result.h @@ -321,8 +321,9 @@ template class Result { /// ``` template class Result { private: - using ErrorStorage = - typename std::aligned_storage::type; + using ErrorStorage = struct alignas(E) { + std::byte data[sizeof(E)]; + }; ErrorStorage error_storage_; bool has_value_;