| 1 | // Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. |
| 2 | // Copyright (C) 2015 Andrzej Krzemienski. |
| 3 | // |
| 4 | // Use, modification, and distribution is subject to the Boost Software |
| 5 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 6 | // http://www.boost.org/LICENSE_1_0.txt) |
| 7 | // |
| 8 | // See http://www.boost.org/libs/optional for documentation. |
| 9 | // |
| 10 | // You are welcome to contact the author at: |
| 11 | // akrzemi1@gmail.com |
| 12 | |
| 13 | #ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_CONFIG_AJK_28JAN2015_HPP |
| 14 | #define BOOST_OPTIONAL_DETAIL_OPTIONAL_CONFIG_AJK_28JAN2015_HPP |
| 15 | |
| 16 | #include <boost/config.hpp> |
| 17 | #include <boost/detail/workaround.hpp> |
| 18 | |
| 19 | #if (defined BOOST_NO_CXX11_RVALUE_REFERENCES) || (defined BOOST_OPTIONAL_CONFIG_NO_RVALUE_REFERENCES) |
| 20 | # define BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES |
| 21 | #endif |
| 22 | |
| 23 | #if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION,<=700) |
| 24 | // AFAICT only Intel 7 correctly resolves the overload set |
| 25 | // that includes the in-place factory taking functions, |
| 26 | // so for the other icc versions, in-place factory support |
| 27 | // is disabled |
| 28 | # define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT |
| 29 | #endif |
| 30 | |
| 31 | #if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) |
| 32 | // BCB (5.5.1) cannot parse the nested template struct in an inplace factory. |
| 33 | # define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT |
| 34 | #endif |
| 35 | |
| 36 | #if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) \ |
| 37 | && defined BOOST_BCB_PARTIAL_SPECIALIZATION_BUG |
| 38 | // BCB (up to 5.64) has the following bug: |
| 39 | // If there is a member function/operator template of the form |
| 40 | // template<class Expr> mfunc( Expr expr ) ; |
| 41 | // some calls are resolved to this even if there are other better matches. |
| 42 | // The effect of this bug is that calls to converting ctors and assignments |
| 43 | // are incorrectly sink to this general catch-all member function template as shown above. |
| 44 | # define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION |
| 45 | #endif |
| 46 | |
| 47 | #if defined(__GNUC__) && !defined(__INTEL_COMPILER) |
| 48 | // GCC since 3.3 has may_alias attribute that helps to alleviate optimizer issues with |
| 49 | // regard to violation of the strict aliasing rules. The optional< T > storage type is marked |
| 50 | // with this attribute in order to let the compiler know that it will alias objects of type T |
| 51 | // and silence compilation warnings. |
| 52 | # define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS |
| 53 | #endif |
| 54 | |
| 55 | #if (defined(_MSC_VER) && _MSC_VER <= 1800) |
| 56 | // on MSCV 2013 and earlier an unwanted temporary is created when you assign from |
| 57 | // a const lvalue of integral type. Thus we bind not to the original address but |
| 58 | // to a temporary. |
| 59 | # define BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT |
| 60 | #endif |
| 61 | |
| 62 | #if (defined __GNUC__) && (!defined BOOST_INTEL_CXX_VERSION) && (!defined __clang__) |
| 63 | // On some GCC versions an unwanted temporary is created when you copy-initialize |
| 64 | // from a const lvalue of integral type. Thus we bind not to the original address but |
| 65 | // to a temporary. |
| 66 | |
| 67 | # if (__GNUC__ < 4) |
| 68 | # define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT |
| 69 | # endif |
| 70 | |
| 71 | # if (__GNUC__ == 4 && __GNUC_MINOR__ <= 5) |
| 72 | # define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT |
| 73 | # endif |
| 74 | |
| 75 | # if (__GNUC__ == 5 && __GNUC_MINOR__ < 2) |
| 76 | # define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT |
| 77 | # endif |
| 78 | |
| 79 | # if (__GNUC__ == 5 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ == 0) |
| 80 | # define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT |
| 81 | # endif |
| 82 | |
| 83 | #endif // defined(__GNUC__) |
| 84 | |
| 85 | #if (defined __GNUC__) && (!defined BOOST_NO_CXX11_RVALUE_REFERENCES) |
| 86 | // On some initial rvalue reference implementations GCC does it in a strange way, |
| 87 | // preferring perfect-forwarding constructor to implicit copy constructor. |
| 88 | |
| 89 | # if (__GNUC__ == 4 && __GNUC_MINOR__ == 4) |
| 90 | # define BOOST_OPTIONAL_CONFIG_NO_LEGAL_CONVERT_FROM_REF |
| 91 | # endif |
| 92 | |
| 93 | # if (__GNUC__ == 4 && __GNUC_MINOR__ == 5) |
| 94 | # define BOOST_OPTIONAL_CONFIG_NO_LEGAL_CONVERT_FROM_REF |
| 95 | # endif |
| 96 | |
| 97 | #endif // defined(__GNUC__) |
| 98 | |
| 99 | #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500) && !defined(__SUNPRO_CC) |
| 100 | // this condition is a copy paste from is_constructible.hpp |
| 101 | // I also disable SUNPRO, as it seems not to support type_traits correctly |
| 102 | #else |
| 103 | # define BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT |
| 104 | #endif |
| 105 | |
| 106 | #if defined __SUNPRO_CC |
| 107 | # define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS |
| 108 | #elif (defined _MSC_FULL_VER) && (_MSC_FULL_VER < 190023026) |
| 109 | # define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS |
| 110 | #elif defined BOOST_GCC && !defined BOOST_GCC_CXX11 |
| 111 | # define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS |
| 112 | #elif defined BOOST_GCC_VERSION && BOOST_GCC_VERSION < 40800 |
| 113 | # define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS |
| 114 | #endif |
| 115 | |
| 116 | #endif // header guard |
| 117 | |