From 7ae2db7312a4f2bcdacb80373b0f7ec0f273adaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Krzemie=C5=84ski?= Date: Thu, 18 Feb 2016 11:00:24 +0100 Subject: [PATCH] Conditionally removing optional destructor --- include/boost/optional/optional.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 9d20282..d227af5 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -678,8 +678,12 @@ class optional : public optional_detail::optional_base {} #endif - // I need this declaration for msvc-8.0 (otherwise, T::~T() is never called) - ~optional() {} + +#if BOOST_WORKAROUND(_MSC_VER, <= 1500) + // On old MSVC compilers the implicitly declared dtor is not called + ~optional() {} +#else + #if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) // Assigns from an expression. See corresponding constructor.