diff --git a/doc/html/boost_config/boost_macro_reference.html b/doc/html/boost_config/boost_macro_reference.html index d5b41a20..4bc38c66 100644 --- a/doc/html/boost_config/boost_macro_reference.html +++ b/doc/html/boost_config/boost_macro_reference.html @@ -4544,7 +4544,14 @@ when the current context is constexpr and false otherwise. This macro may be functional in C++14 onwards if the compiler has a suitable intrinsic we recognise (MSVC/Clang/GCC - are currently supported). The macro always evaluates to false on unsupported/old compilers. + are currently supported). +

+

+ Note that before using this macro, the program must include <type_traits>. +

+

+ The macro always evaluates to false + on unsupported/old compilers.

@@ -4561,8 +4568,20 @@ The macro may be functional in C++14 onwards if the compiler has a suitable intrinsic, in particular this macro is functional for gcc-6 and onwards as well as for compilers which have direct support - for std::is_constant_evaluated. The macro - always evaluates to false + for std::is_constant_evaluated. +

+

+ Note that before using this macro, the program must include <type_traits>. +

+

+ Note that this macro may behave subtly different from std::is_constant_evaluated() + in that it may evaluate to true + when code is evaluated in a non-constexpr context, but is none + the less evaluated at "compile time" as a result of program + optimisation. +

+

+ The macro always evaluates to false on unsupported/old compilers.

diff --git a/doc/html/index.html b/doc/html/index.html index 288f686e..7e37d269 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -996,7 +996,7 @@ - +

Last revised: August 08, 2021 at 18:21:47 GMT

Last revised: August 09, 2021 at 18:40:57 GMT


diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index 5c0187bb..c8f2559b 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -1088,10 +1088,20 @@ that are not yet supported by a particular compiler or library. [[macro][Description]] [[`BOOST_IS_CONSTANT_EVALUATED()`][Evaluated to `true` when the current context is `constexpr` and false otherwise. This macro may be functional in C++14 onwards if the compiler has a suitable intrinsic we recognise (MSVC/Clang/GCC are currently supported). + + Note that before using this macro, the program must include ``. + The macro always evaluates to `false` on unsupported/old compilers.]] [[`BOOST_IS_CONSTANT_EVALUATED_INT(integer-expression)`][Evaluates to `true` when `integer-expression` is `constexpr`. The macro may be functional in C++14 onwards if the compiler has a suitable intrinsic, in particular this macro is functional for gcc-6 and onwards as well as for compilers which have direct support for `std::is_constant_evaluated`. + + Note that before using this macro, the program must include ``. + + Note that this macro may behave subtly different from `std::is_constant_evaluated()` in that it may evaluate to + `true` when code is evaluated in a non-constexpr context, but is none the less evaluated at "compile time" as a result + of program optimisation. + The macro always evaluates to `false` on unsupported/old compilers.]] [[BOOST_IS_CONSTANT_EVALUATED_VERSION][Evaluates to 0 if there is no support for this feature, 1 if `BOOST_IS_CONSTANT_EVALUATED_INT` is fully functional, and 2 if both BOOST_IS_CONSTANT_EVALUATED_INT and BOOST_IS_CONSTANT_EVALUATED are fully functional.]] diff --git a/include/boost/config/detail/suffix.hpp b/include/boost/config/detail/suffix.hpp index ddaeb368..f8d19bbd 100644 --- a/include/boost/config/detail/suffix.hpp +++ b/include/boost/config/detail/suffix.hpp @@ -1094,7 +1094,7 @@ namespace std{ using ::type_info; } # define BOOST_IS_CONSTANT_EVALUATED_INT(integer) BOOST_CONFIG_IS_CONST_EVALUATED_INT(integer) # define BOOST_IS_CONSTANT_EVALUATED_VERSION 1 #else -# define BOOST_IS_CONSTANT_EVALUATED false +# define BOOST_IS_CONSTANT_EVALUATED_INT(i) false #endif #ifndef BOOST_IS_CONSTANT_EVALUATED_VERSION diff --git a/test/test_boost_is_constant_evaluated.cpp b/test/test_boost_is_constant_evaluated.cpp index fedd062b..81cd08a5 100644 --- a/test/test_boost_is_constant_evaluated.cpp +++ b/test/test_boost_is_constant_evaluated.cpp @@ -7,6 +7,7 @@ #ifndef BOOST_NO_CXX11_HDR_TYPE_TRAITS #include +#include #if BOOST_IS_CONSTANT_EVALUATED_VERSION >= 2 inline constexpr int factorial1(int i)