diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp index 594c44f5..9ae6072e 100644 --- a/include/boost/config/compiler/gcc.hpp +++ b/include/boost/config/compiler/gcc.hpp @@ -232,7 +232,6 @@ // C++0x features in 4.6.n and later // #if (BOOST_GCC_VERSION < 40600) || !defined(BOOST_GCC_CXX11) -#define BOOST_NO_CXX11_CONSTEXPR #define BOOST_NO_CXX11_DEFAULTED_MOVES #define BOOST_NO_CXX11_NOEXCEPT #define BOOST_NO_CXX11_NULLPTR @@ -243,6 +242,9 @@ // C++0x features in 4.7.n and later // #if (BOOST_GCC_VERSION < 40700) || !defined(BOOST_GCC_CXX11) +// Note that while constexpr is partly supported in gcc-4.6 it's a +// pre-std version with several bugs: +# define BOOST_NO_CXX11_CONSTEXPR # define BOOST_NO_CXX11_FINAL # define BOOST_NO_CXX11_TEMPLATE_ALIASES # define BOOST_NO_CXX11_USER_DEFINED_LITERALS diff --git a/test/boost_no_constexpr.ipp b/test/boost_no_constexpr.ipp index 35ac4891..1f3a96ee 100644 --- a/test/boost_no_constexpr.ipp +++ b/test/boost_no_constexpr.ipp @@ -32,13 +32,7 @@ private: template struct X { }; - -#if __cplusplus < 201400L -// Some C++14 compilers reject this (clang), some C++11 compilers reject "constexpr const" (GCC-4.6) -constexpr A a = 42; -#else constexpr const A a = 42; -#endif X xx; // OK: unique conversion to int @@ -68,9 +62,18 @@ struct F : virtual E }; constexpr F& f(F& out) { return out; } +namespace whatever{}; + +constexpr int factorial(int i) +{ + typedef int value_type; + using namespace whatever; + return i <= 1 ? 1 : i * factorial(value_type(i-1)); +} + int test() { - int i = square(5); + constexpr int i = square(5) + factorial(10); quiet_warning(i); switch (i)