mirror of
https://github.com/boostorg/config.git
synced 2025-07-30 04:17:16 +02:00
Define BOOST_NO_CXX14_CONSTEXPR unless clang > 3.4.
Signed-off-by: Kohei Takahashi <flast@flast.jp>
This commit is contained in:
@ -225,7 +225,16 @@
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_relaxed_constexpr) || __has_extension(cxx_relaxed_constexpr))
|
||||
// clang < 3.5 has a defect with dependent type, like following.
|
||||
//
|
||||
// template <class T>
|
||||
// constexpr typename enable_if<pred<T> >::type foo(T &)
|
||||
// { } // error: no return statement in constexpr function
|
||||
//
|
||||
// This issue also affects C++11 mode, but C++11 constexpr requires return stmt.
|
||||
// Therefore we don't care such case.
|
||||
#if (__clang_major__ == 3 && __clang_minor__ < 5) \
|
||||
|| !(__has_feature(cxx_relaxed_constexpr) || __has_extension(cxx_relaxed_constexpr))
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,15 @@
|
||||
namespace boost_no_cxx14_constexpr
|
||||
{
|
||||
|
||||
constexpr void decrement(int &value)
|
||||
namespace detail
|
||||
{
|
||||
template <class> struct void_ { typedef void type; };
|
||||
}
|
||||
|
||||
// Test relaxed constexpr with dependent type; for more details, see comment of
|
||||
// BOOST_CXX14_CONSTEXPR definition in boost/config/compiler/clang.hpp .
|
||||
template <class T>
|
||||
constexpr typename detail::void_<T>::type decrement(T &value)
|
||||
{
|
||||
--value;
|
||||
}
|
||||
|
Reference in New Issue
Block a user