Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:32

0001 //-----------------------------------------------------------------------------
0002 // boost variant/detail/forced_return.hpp header file
0003 // See http://www.boost.org for updates, documentation, and revision history.
0004 //-----------------------------------------------------------------------------
0005 //
0006 // Copyright (c) 2003 Eric Friedman
0007 // Copyright (c) 2015-2023 Antony Polukhin
0008 //
0009 // Distributed under the Boost Software License, Version 1.0. (See
0010 // accompanying file LICENSE_1_0.txt or copy at
0011 // http://www.boost.org/LICENSE_1_0.txt)
0012 
0013 #ifndef BOOST_VARIANT_DETAIL_FORCED_RETURN_HPP
0014 #define BOOST_VARIANT_DETAIL_FORCED_RETURN_HPP
0015 
0016 #include <boost/config.hpp>
0017 #include <boost/assert.hpp>
0018 
0019 
0020 #ifdef BOOST_MSVC
0021 # pragma warning( push )
0022 # pragma warning( disable : 4702 ) // unreachable code
0023 #endif
0024 
0025 namespace boost { namespace detail { namespace variant {
0026 
0027 ///////////////////////////////////////////////////////////////////////////////
0028 // (detail) function template forced_return
0029 //
0030 // Logical error to permit invocation at runtime, but (artificially) satisfies
0031 // compile-time requirement of returning a result value.
0032 //
0033 template <typename T>
0034 BOOST_NORETURN inline T
0035 forced_return()
0036 {
0037     // logical error: should never be here! (see above)
0038     BOOST_ASSERT(false);
0039 
0040     T (*dummy)() = 0;
0041     (void)dummy;
0042     BOOST_UNREACHABLE_RETURN(dummy());
0043 }
0044 
0045 }}} // namespace boost::detail::variant
0046 
0047 
0048 #ifdef BOOST_MSVC
0049 # pragma warning( pop )
0050 #endif
0051 
0052 #endif // BOOST_VARIANT_DETAIL_FORCED_RETURN_HPP