From 8433fc178c51bdc1f0e82c241dc390d380c35e18 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 20 Mar 2021 13:16:10 +0100 Subject: [PATCH] Fix issue for union with visual & clang-cl --- m-buffer.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/m-buffer.h b/m-buffer.h index 8cd1412a..e07dab97 100644 --- a/m-buffer.h +++ b/m-buffer.h @@ -130,9 +130,13 @@ typedef enum { of atomic operations if the buffer is not thread safe. */ -typedef union { +typedef union m_buff3r_number_s { unsigned int u; atomic_uint a; +#ifdef __cplusplus + // Not sure why, but C++ needs an explicit default constructor for this union. + m_buff3r_number_s() : u(0) {}; +#endif } m_buff3r_number_ct[1]; static inline void