From 6375fccf278571aad2af5c696a43c7d7bd9f213c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Krzemie=C5=84ski?= Date: Sat, 10 Oct 2015 15:23:38 +0200 Subject: [PATCH] NO_PROPER_CONVERT_FROM_CONST_INT macro --- include/boost/optional/detail/optional_config.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/boost/optional/detail/optional_config.hpp b/include/boost/optional/detail/optional_config.hpp index 4c1e539..bab9236 100644 --- a/include/boost/optional/detail/optional_config.hpp +++ b/include/boost/optional/detail/optional_config.hpp @@ -59,4 +59,13 @@ # define BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT #endif +#if defined(__GNUC__) +# if (__GNUC__ == 5 && __GNUC_MINOR__ <= 2) || (__GNUC__ == 6 && __GNUC_MINOR__ < 1) +// On GCC 5.1, 5.2 and 6.0 an unwanted temporary is created when you copy-initialize +// from a const lvalue of integral type. Thus we bind not to the original address but +// to a temporary. +# define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT +# endif +#endif + #endif // header guard