From c77f1a26f59a45b14f6101fc8cf1733351f5c1f2 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sat, 1 Oct 2016 02:56:31 -0400 Subject: [PATCH] Boy, these compilers SUCK. --- Optional | 2 +- single/sol/sol.hpp | 31 ++++++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Optional b/Optional index 53f2364bc..298c2fc5b 160000 --- a/Optional +++ b/Optional @@ -1 +1 @@ -Subproject commit 53f2364bcf7aab9b2d9fe6ae56ad5c1543206820 +Subproject commit 298c2fc5b3a70db73a916e6036cc7db63fb35551 diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index e11501e45..cae47cc5c 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2016-10-01 06:28:57.464339 UTC -// This header was generated with sol v2.14.8 (revision b05ce97) +// Generated 2016-10-01 06:56:10.404062 UTC +// This header was generated with sol v2.14.8 (revision 72f39d8) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -804,7 +804,10 @@ namespace sol { # define TR2_OPTIONAL_REQUIRES(...) typename ::std::enable_if<__VA_ARGS__::value, bool>::type = false # if defined __GNUC__ // NOTE: GNUC is also defined for Clang -# if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8) +# if (__GNUC__ >= 5) +# define TR2_OPTIONAL_GCC_5_0_AND_HIGHER___ +# define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___ +# elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8) # define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___ # elif (__GNUC__ > 4) # define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___ @@ -1022,25 +1025,23 @@ struct optional_base constexpr optional_base() noexcept : init_(false), storage_() {}; - explicit constexpr optional_base(const T& v) : init_(true), storage_() { + explicit optional_base(const T& v) : init_(true), storage_() { new (&storage())T(v); } - explicit constexpr optional_base(T&& v) : init_(true), storage_() { + explicit optional_base(T&& v) : init_(true), storage_() { new (&storage())T(constexpr_move(v)); } template explicit optional_base(in_place_t, Args&&... args) : init_(true), storage_() { - void* space = static_cast(&storage_[0]); - new (space)T(constexpr_forward(args)...); + new (&storage())T(constexpr_forward(args)...); } template >)> explicit optional_base(in_place_t, ::std::initializer_list il, Args&&... args) : init_(true), storage_() { - void* space = static_cast(&storage_[0]); - new (space)T(constexpr_forward(args)...); + new (&storage())T(il, constexpr_forward(args)...); } #if defined __GNUC__ #pragma GCC diagnostic push @@ -1060,12 +1061,15 @@ struct optional_base ~optional_base() { if (init_) { storage().T::~T(); } } }; +#if defined __GNUC__ && !defined TR2_OPTIONAL_GCC_5_0_AND_HIGHER___ +template +using constexpr_optional_base = optional_base; +#else template struct constexpr_optional_base { bool init_; char storage_[sizeof(T)]; - constexpr constexpr_optional_base() noexcept : init_(false), storage_() {} explicit constexpr constexpr_optional_base(const T& v) : init_(true), storage_() { @@ -1082,9 +1086,9 @@ struct constexpr_optional_base } template >)> - OPTIONAL_CONSTEXPR_INIT_LIST explicit constexpr_optional_base(in_place_t, ::std::initializer_list il, Args&&... args) - : init_(true), storage_() { - new (&storage())T(constexpr_forward(args)...); + OPTIONAL_CONSTEXPR_INIT_LIST explicit constexpr_optional_base(in_place_t, ::std::initializer_list il, Args&&... args) + : init_(true), storage_() { + new (&storage())T(il, constexpr_forward(args)...); } #if defined __GNUC__ @@ -1104,6 +1108,7 @@ struct constexpr_optional_base ~constexpr_optional_base() = default; }; +#endif template using OptionalBase = typename ::std::conditional<