Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Fix alignment for Catch::Option

This is so much easier in C++11...
Commit
bffef1bffa5d35c22168fe011bc7aad9a1e4c228
Author
Martin Hořeňovský ·
Parents
7e142329243f

Files · Download .tar.gz

Changes

 include/internal/catch_option.hpp | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/include/internal/catch_option.hpp b/include/internal/catch_option.hpp
index 8b146da6..6653649e 100644
--- a/include/internal/catch_option.hpp
+++ b/include/internal/catch_option.hpp
@@ -67,15 +67,7 @@ namespace Catch {
 
     private:
         T *nullableValue;
-        union {
-            char storage[sizeof(T)];
-    
-            // These are here to force alignment for the storage
-            long double dummy1;
-            void (*dummy2)();
-            long double dummy3;
-            long long dummy4;
-        };
+        alignas(alignof(T)) char storage[sizeof(T)];
     };
 
 } // end namespace Catch