diff --git a/tl/expected.hpp b/tl/expected.hpp index 9ec1a1f..79313ba 100644 --- a/tl/expected.hpp +++ b/tl/expected.hpp @@ -325,11 +325,11 @@ struct expected_storage_base { m_unexpect.~unexpected(); } } - bool m_has_val; union { T m_val; unexpected m_unexpect; }; + bool m_has_val; }; // This specialization is for when both `T` and `E` are trivially-destructible, @@ -365,11 +365,11 @@ template struct expected_storage_base { : m_unexpect(il, std::forward(args)...), m_has_val(false) {} ~expected_storage_base() = default; - bool m_has_val; union { T m_val; unexpected m_unexpect; }; + bool m_has_val; }; // T is trivial, E is not. @@ -409,11 +409,11 @@ template struct expected_storage_base { } } - bool m_has_val; union { T m_val; unexpected m_unexpect; }; + bool m_has_val; }; // E is trivial, T is not. @@ -452,11 +452,11 @@ template struct expected_storage_base { m_val.~T(); } } - bool m_has_val; union { T m_val; unexpected m_unexpect; }; + bool m_has_val; }; // `T` is `void`, `E` is trivially-destructible @@ -481,12 +481,12 @@ template struct expected_storage_base { : m_unexpect(il, std::forward(args)...), m_has_val(false) {} ~expected_storage_base() = default; - bool m_has_val; struct dummy {}; union { dummy m_val; unexpected m_unexpect; }; + bool m_has_val; }; // `T` is `void`, `E` is not trivially-destructible @@ -516,12 +516,12 @@ template struct expected_storage_base { } } - bool m_has_val; struct dummy {}; union { dummy m_val; unexpected m_unexpect; }; + bool m_has_val; }; // This base class provides some handy member functions which can be used in