message: fix std::uncaught_exceptions - closes
diff: @@ -926,9 +926,6 @@ namespace detail {
  DOCTEST_ITERATE_THROUGH_REPORTERS(subcase_start, m_signature);
  }
  - DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4996) // std::uncaught_exception is deprecated in C++17
  - DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
  - DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
  Subcase::~Subcase() {
  if(m_entered) {
  // only mark the subcase stack as passed if no subcases have been skipped
  @@ -936,7 +933,12 @@ namespace detail {
  g_cs->subcasesPassed.insert(g_cs->subcasesStack);
  g_cs->subcasesStack.pop_back();
  - if(std::uncaught_exception() && g_cs->shouldLogCurrentException) {
  +#if __cplusplus >= 201703L && defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411
  + if(std::uncaught_exceptions() > 0
  +#else
  + if(std::uncaught_exception()
  +#endif
  + && g_cs->shouldLogCurrentException) {
  DOCTEST_ITERATE_THROUGH_REPORTERS(
  test_case_exception, {"exception thrown in subcase - will translate later "
  "when the whole test case has been exited (cannot "
  @@ -947,9 +949,6 @@ namespace detail {
  DOCTEST_ITERATE_THROUGH_REPORTERS(subcase_end, DOCTEST_EMPTY);
  }
  }
  - DOCTEST_CLANG_SUPPRESS_WARNING_POP
  - DOCTEST_GCC_SUPPRESS_WARNING_POP
  - DOCTEST_MSVC_SUPPRESS_WARNING_POP
  Subcase::operator bool() const { return m_entered; }
  @@ -1270,23 +1269,21 @@ namespace detail {
  g_infoContexts.push_back(this);
  }
  - DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4996) // std::uncaught_exception is deprecated in C++17
  - DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
  - DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
  // destroy cannot be inlined into the destructor because that would mean calling stringify after
  // ContextScope has been destroyed (base class destructors run after derived class destructors).
  // Instead, ContextScope calls this method directly from its destructor.
  void ContextScopeBase::destroy() {
  +#if __cplusplus >= 201703L && defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411
  + if(std::uncaught_exceptions() > 0) {
  +#else
  if(std::uncaught_exception()) {
  +#endif
  std::ostringstream s;
  this->stringify(&s);
  g_cs->stringifiedContexts.push_back(s.str().c_str());
  }
  g_infoContexts.pop_back();
  }
  - DOCTEST_CLANG_SUPPRESS_WARNING_POP
  - DOCTEST_GCC_SUPPRESS_WARNING_POP
  - DOCTEST_MSVC_SUPPRESS_WARNING_POP
  } // namespace detail
  namespace {
  