diff --git a/include/boost/implicit_cast.hpp b/include/boost/implicit_cast.hpp index 03abe1d..09e5f45 100644 --- a/include/boost/implicit_cast.hpp +++ b/include/boost/implicit_cast.hpp @@ -6,6 +6,11 @@ #ifndef BOOST_IMPLICIT_CAST_DWA200356_HPP #define BOOST_IMPLICIT_CAST_DWA200356_HPP +#include +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + namespace boost { namespace detail { @@ -23,7 +28,7 @@ template struct icast_identity // The use of identity creates a non-deduced form, so that the // explicit template argument must be supplied template -inline T implicit_cast (typename boost::detail::icast_identity::type x) { +BOOST_CONSTEXPR inline T implicit_cast (typename boost::detail::icast_identity::type x) { return x; } diff --git a/test/implicit_cast.cpp b/test/implicit_cast.cpp index eaca42a..ea56f66 100644 --- a/test/implicit_cast.cpp +++ b/test/implicit_cast.cpp @@ -34,5 +34,9 @@ int main() (void)f; (void)z; + + BOOST_CONSTEXPR long value = boost::implicit_cast(42); + BOOST_TEST(value == 42L); + return boost::report_errors(); }