From 04dc6e9ebb264d8baa4aa42428b44d21ce3d3abb Mon Sep 17 00:00:00 2001 From: Dobiasd Date: Thu, 8 Aug 2024 14:55:47 +0200 Subject: [PATCH 1/5] Replace deprecated std::aligned_storage with alignas see https://stackoverflow.com/a/71828512/1866775 --- include/fplus/maybe.hpp | 2 +- include_all_in_one/include/fplus/fplus.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fplus/maybe.hpp b/include/fplus/maybe.hpp index 54758f15..a2d8b72d 100644 --- a/include/fplus/maybe.hpp +++ b/include/fplus/maybe.hpp @@ -240,7 +240,7 @@ class maybe { } } bool is_present_; - typename std::aligned_storage::type value_; + alignas(T) std::byte value_[sizeof(T)]; }; // API search type: is_just : Maybe a -> Bool diff --git a/include_all_in_one/include/fplus/fplus.hpp b/include_all_in_one/include/fplus/fplus.hpp index 799b670d..a22a1118 100644 --- a/include_all_in_one/include/fplus/fplus.hpp +++ b/include_all_in_one/include/fplus/fplus.hpp @@ -2797,7 +2797,7 @@ class maybe { } } bool is_present_; - typename std::aligned_storage::type value_; + alignas(T) std::byte value_[sizeof(T)]; }; // API search type: is_just : Maybe a -> Bool From 0354ac3f6937982f0f3df36a2c821f7c58d39af2 Mon Sep 17 00:00:00 2001 From: Dobiasd Date: Thu, 8 Aug 2024 14:59:23 +0200 Subject: [PATCH 2/5] Use unsigned char instead of std::byte for C++14 compatibility --- include/fplus/maybe.hpp | 2 +- include_all_in_one/include/fplus/fplus.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fplus/maybe.hpp b/include/fplus/maybe.hpp index a2d8b72d..4942e696 100644 --- a/include/fplus/maybe.hpp +++ b/include/fplus/maybe.hpp @@ -240,7 +240,7 @@ class maybe { } } bool is_present_; - alignas(T) std::byte value_[sizeof(T)]; + alignas(T) unsigned char value_[sizeof(T)]; }; // API search type: is_just : Maybe a -> Bool diff --git a/include_all_in_one/include/fplus/fplus.hpp b/include_all_in_one/include/fplus/fplus.hpp index a22a1118..0b78ce0d 100644 --- a/include_all_in_one/include/fplus/fplus.hpp +++ b/include_all_in_one/include/fplus/fplus.hpp @@ -2797,7 +2797,7 @@ class maybe { } } bool is_present_; - alignas(T) std::byte value_[sizeof(T)]; + alignas(T) unsigned char value_[sizeof(T)]; }; // API search type: is_just : Maybe a -> Bool From 3ee0dc4b497613ed7d7056f7277f22c7ad29a351 Mon Sep 17 00:00:00 2001 From: Dobiasd Date: Thu, 8 Aug 2024 15:04:49 +0200 Subject: [PATCH 3/5] Disable warning 4127 in MSVC --- include/fplus/maybe.hpp | 7 +++++++ include_all_in_one/include/fplus/fplus.hpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/include/fplus/maybe.hpp b/include/fplus/maybe.hpp index 4942e696..222ab81e 100644 --- a/include/fplus/maybe.hpp +++ b/include/fplus/maybe.hpp @@ -240,7 +240,14 @@ class maybe { } } bool is_present_; +#ifdef _MSC_VER + __pragma(warning(push)) + __pragma(warning(disable : 4127)) +#endif alignas(T) unsigned char value_[sizeof(T)]; +#ifdef _MSC_VER + __pragma(warning(pop)) +#endif }; // API search type: is_just : Maybe a -> Bool diff --git a/include_all_in_one/include/fplus/fplus.hpp b/include_all_in_one/include/fplus/fplus.hpp index 0b78ce0d..bc792f9f 100644 --- a/include_all_in_one/include/fplus/fplus.hpp +++ b/include_all_in_one/include/fplus/fplus.hpp @@ -2797,7 +2797,14 @@ class maybe { } } bool is_present_; +#ifdef _MSC_VER + __pragma(warning(push)) + __pragma(warning(disable : 4127)) +#endif alignas(T) unsigned char value_[sizeof(T)]; +#ifdef _MSC_VER + __pragma(warning(pop)) +#endif }; // API search type: is_just : Maybe a -> Bool From 70daf285dea8b3398820073488b09b90e848bfed Mon Sep 17 00:00:00 2001 From: Dobiasd Date: Thu, 8 Aug 2024 15:08:03 +0200 Subject: [PATCH 4/5] fix formatting --- include/fplus/maybe.hpp | 2 +- include_all_in_one/include/fplus/fplus.hpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/fplus/maybe.hpp b/include/fplus/maybe.hpp index 222ab81e..2a4c5d5f 100644 --- a/include/fplus/maybe.hpp +++ b/include/fplus/maybe.hpp @@ -244,7 +244,7 @@ class maybe { __pragma(warning(push)) __pragma(warning(disable : 4127)) #endif - alignas(T) unsigned char value_[sizeof(T)]; + alignas(T) unsigned char value_[sizeof(T)]; #ifdef _MSC_VER __pragma(warning(pop)) #endif diff --git a/include_all_in_one/include/fplus/fplus.hpp b/include_all_in_one/include/fplus/fplus.hpp index bc792f9f..89cac77d 100644 --- a/include_all_in_one/include/fplus/fplus.hpp +++ b/include_all_in_one/include/fplus/fplus.hpp @@ -868,8 +868,7 @@ namespace internal { static std::false_type is_refwrap_test(const U&); template - struct is_reference_wrapper : decltype(is_refwrap_test(std::declval())) { - }; + struct is_reference_wrapper : decltype(is_refwrap_test(std::declval())) {}; template ::type> struct unwrap_reference_wrapper { @@ -2801,7 +2800,7 @@ class maybe { __pragma(warning(push)) __pragma(warning(disable : 4127)) #endif - alignas(T) unsigned char value_[sizeof(T)]; + alignas(T) unsigned char value_[sizeof(T)]; #ifdef _MSC_VER __pragma(warning(pop)) #endif From ae2d9d9c3815c034d98ecfc997050d1bb531d558 Mon Sep 17 00:00:00 2001 From: Dobiasd Date: Thu, 8 Aug 2024 15:18:20 +0200 Subject: [PATCH 5/5] Disable warning 4324 in MSVC --- include/fplus/maybe.hpp | 2 +- include_all_in_one/include/fplus/fplus.hpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/fplus/maybe.hpp b/include/fplus/maybe.hpp index 2a4c5d5f..fbe59eac 100644 --- a/include/fplus/maybe.hpp +++ b/include/fplus/maybe.hpp @@ -242,7 +242,7 @@ class maybe { bool is_present_; #ifdef _MSC_VER __pragma(warning(push)) - __pragma(warning(disable : 4127)) + __pragma(warning(disable : 4324)) #endif alignas(T) unsigned char value_[sizeof(T)]; #ifdef _MSC_VER diff --git a/include_all_in_one/include/fplus/fplus.hpp b/include_all_in_one/include/fplus/fplus.hpp index 89cac77d..80894cdd 100644 --- a/include_all_in_one/include/fplus/fplus.hpp +++ b/include_all_in_one/include/fplus/fplus.hpp @@ -868,7 +868,8 @@ namespace internal { static std::false_type is_refwrap_test(const U&); template - struct is_reference_wrapper : decltype(is_refwrap_test(std::declval())) {}; + struct is_reference_wrapper : decltype(is_refwrap_test(std::declval())) { + }; template ::type> struct unwrap_reference_wrapper { @@ -2798,7 +2799,7 @@ class maybe { bool is_present_; #ifdef _MSC_VER __pragma(warning(push)) - __pragma(warning(disable : 4127)) + __pragma(warning(disable : 4324)) #endif alignas(T) unsigned char value_[sizeof(T)]; #ifdef _MSC_VER