Skip to content

Commit

Permalink
Fixed an error in ifdefs for verbose_diagnostic_info
Browse files Browse the repository at this point in the history
  • Loading branch information
zajo committed Dec 10, 2023
1 parent 95fff4a commit c0ce397
Showing 1 changed file with 49 additions and 2 deletions.
51 changes: 49 additions & 2 deletions include/boost/leaf/handle_errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ namespace leaf_detail

////////////////////////////////////////

#if BOOST_LEAF_CFG_DIAGNOSTICS && BOOST_LEAF_CFG_CAPTURE
#if BOOST_LEAF_CFG_DIAGNOSTICS

#if BOOST_LEAF_CFG_CAPTURE

class verbose_diagnostic_info: public diagnostic_info
{
Expand Down Expand Up @@ -233,6 +235,51 @@ namespace leaf_detail

#else

class verbose_diagnostic_info: public diagnostic_info
{
protected:

verbose_diagnostic_info( verbose_diagnostic_info const & ) noexcept = default;

template <class Tup>
BOOST_LEAF_CONSTEXPR verbose_diagnostic_info( error_info const & ei, Tup const & tup ) noexcept:
diagnostic_info(ei, tup),
{
}

template <class CharT, class Traits>
friend std::ostream & operator<<( std::basic_ostream<CharT, Traits> & os, verbose_diagnostic_info const & x )
{
return os << "verbose_diagnostic_info not available due to BOOST_LEAF_CFG_CAPTURE=0. Basic diagnostic_info follows.\n" << static_cast<diagnostic_info const &>(x);
}
};

namespace leaf_detail
{
struct verbose_diagnostic_info_: verbose_diagnostic_info
{
template <class Tup>
BOOST_LEAF_CONSTEXPR verbose_diagnostic_info_( error_info const & ei, Tup const & tup, ) noexcept:
verbose_diagnostic_info(ei, tup)
{
}
};

template <>
struct handler_argument_traits<verbose_diagnostic_info const &>: handler_argument_always_available<void>
{
template <class Tup>
BOOST_LEAF_CONSTEXPR static verbose_diagnostic_info_ get( Tup const & tup, error_info const & ei ) noexcept
{
return verbose_diagnostic_info_(ei, tup);
}
};
}

#endif

#else

class verbose_diagnostic_info: public diagnostic_info
{
protected:
Expand All @@ -247,7 +294,7 @@ class verbose_diagnostic_info: public diagnostic_info
template <class CharT, class Traits>
friend std::ostream & operator<<( std::basic_ostream<CharT, Traits> & os, verbose_diagnostic_info const & x )
{
return os << "verbose_diagnostic_info not available due to BOOST_LEAF_CFG_DIAGNOSTICS=0 or BOOST_LEAF_CFG_CAPTURE=0. Basic error_info follows.\n" << static_cast<error_info const &>(x);
return os << "verbose_diagnostic_info not available due to BOOST_LEAF_CFG_DIAGNOSTICS=0. Basic error_info follows.\n" << static_cast<error_info const &>(x);
}
};

Expand Down

0 comments on commit c0ce397

Please sign in to comment.