Hi,

I took the liberty to massage the PR to apply cleanly to version
2.4.8 and uploaded the fix.


Cheers
Timo

--
⢀⣴⠾⠻⢶⣦⠀   ╭────────────────────────────────────────────────────╮
⣾⠁⢠⠒⠀⣿⡁   │ Timo Röhling                                       │
⢿⡄⠘⠷⠚⠋⠀   │ 9B03 EBB9 8300 DF97 C2B1  23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄⠀⠀⠀⠀   ╰────────────────────────────────────────────────────╯
diff -Nru doctest-2.4.8~ds/debian/changelog doctest-2.4.8~ds/debian/changelog
--- doctest-2.4.8~ds/debian/changelog	2022-01-14 22:32:17.000000000 +0100
+++ doctest-2.4.8~ds/debian/changelog	2022-04-21 23:47:01.000000000 +0200
@@ -1,3 +1,10 @@
+doctest (2.4.8~ds-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix build failure with move-only types (Closes: #1005500)
+
+ -- Timo Röhling <roehl...@debian.org>  Thu, 21 Apr 2022 23:47:01 +0200
+
 doctest (2.4.8~ds-1) unstable; urgency=medium
 
   [ upstream ]
diff -Nru doctest-2.4.8~ds/debian/patches/0001_Backport_PR_634.patch doctest-2.4.8~ds/debian/patches/0001_Backport_PR_634.patch
--- doctest-2.4.8~ds/debian/patches/0001_Backport_PR_634.patch	1970-01-01 01:00:00.000000000 +0100
+++ doctest-2.4.8~ds/debian/patches/0001_Backport_PR_634.patch	2022-04-21 23:45:26.000000000 +0200
@@ -0,0 +1,224 @@
+From: Stefan <29021710+saalv...@users.noreply.github.com>
+Date: Thu, 21 Apr 2022 23:41:36 +0200
+Subject: Fix move-only types failing to decompose correctly
+
+This is a backport of commit ce13bc44b99c87e918b98bdadb17008d2dd54d55
+
+Forwarded: https://github.com/doctest/doctest/pull/634
+---
+ doctest/doctest.h                                  | 12 +++++------
+ doctest/parts/doctest_fwd.h                        |  6 +++---
+ examples/all_features/CMakeLists.txt               |  1 +
+ examples/all_features/decomposition.cpp            | 25 ++++++++++++++++++++++
+ .../all_features/test_output/decomposition.cpp.txt | 13 +++++++++++
+ .../test_output/decomposition.cpp_junit.txt        | 14 ++++++++++++
+ .../test_output/decomposition.cpp_xml.txt          | 20 +++++++++++++++++
+ examples/all_features/test_output/filter_2.txt     |  2 +-
+ examples/all_features/test_output/filter_2_xml.txt |  3 ++-
+ 9 files changed, 85 insertions(+), 11 deletions(-)
+ create mode 100644 examples/all_features/decomposition.cpp
+ create mode 100644 examples/all_features/test_output/decomposition.cpp.txt
+ create mode 100644 examples/all_features/test_output/decomposition.cpp_junit.txt
+ create mode 100644 examples/all_features/test_output/decomposition.cpp_xml.txt
+
+diff --git a/doctest/doctest.h b/doctest/doctest.h
+index d25f526..31096ff 100644
+--- a/doctest/doctest.h
++++ b/doctest/doctest.h
+@@ -390,9 +390,9 @@ namespace doctest { namespace detail {
+     static DOCTEST_CONSTEXPR int consume(const int*, int) { return 0; }
+ }}
+ 
+-#define DOCTEST_GLOBAL_NO_WARNINGS(var, ...)                                                       \
+-    DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wglobal-constructors")                              \
+-    static const int var = doctest::detail::consume(&var, __VA_ARGS__);                            \
++#define DOCTEST_GLOBAL_NO_WARNINGS(var, ...)                                                         \
++    DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wglobal-constructors")                                \
++    static const int var = doctest::detail::consume(&var, __VA_ARGS__); /* NOLINT(cert-err58-cpp) */ \
+     DOCTEST_CLANG_SUPPRESS_WARNING_POP
+ 
+ #ifndef DOCTEST_BREAK_INTO_DEBUGGER
+@@ -1320,7 +1320,7 @@ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wunused-comparison")
+         assertType::Enum m_at;
+ 
+         explicit Expression_lhs(L&& in, assertType::Enum at)
+-                : lhs(doctest::detail::forward<L>(in))
++                : lhs(static_cast<L&&>(in))
+                 , m_at(at) {}
+ 
+         DOCTEST_NOINLINE operator Result() {
+@@ -1394,8 +1394,8 @@ DOCTEST_CLANG_SUPPRESS_WARNING_POP
+         // https://github.com/catchorg/Catch2/issues/870
+         // https://github.com/catchorg/Catch2/issues/565
+         template <typename L>
+-        Expression_lhs<const L> operator<<(const L &&operand) {
+-            return Expression_lhs<const L>(doctest::detail::forward<const L>(operand), m_at);
++        Expression_lhs<L> operator<<(L&& operand) {
++            return Expression_lhs<L>(static_cast<L&&>(operand), m_at);
+         }
+ 
+         template <typename L,typename enable_if<!doctest::detail::is_rvalue_reference<L>::value,void >::type* = nullptr>
+diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h
+index b0d786f..ff9fed0 100644
+--- a/doctest/parts/doctest_fwd.h
++++ b/doctest/parts/doctest_fwd.h
+@@ -1317,7 +1317,7 @@ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wunused-comparison")
+         assertType::Enum m_at;
+ 
+         explicit Expression_lhs(L&& in, assertType::Enum at)
+-                : lhs(doctest::detail::forward<L>(in))
++                : lhs(static_cast<L&&>(in))
+                 , m_at(at) {}
+ 
+         DOCTEST_NOINLINE operator Result() {
+@@ -1391,8 +1391,8 @@ DOCTEST_CLANG_SUPPRESS_WARNING_POP
+         // https://github.com/catchorg/Catch2/issues/870
+         // https://github.com/catchorg/Catch2/issues/565
+         template <typename L>
+-        Expression_lhs<const L> operator<<(const L &&operand) {
+-            return Expression_lhs<const L>(doctest::detail::forward<const L>(operand), m_at);
++        Expression_lhs<L> operator<<(L&& operand) {
++            return Expression_lhs<L>(static_cast<L&&>(operand), m_at);
+         }
+ 
+         template <typename L,typename enable_if<!doctest::detail::is_rvalue_reference<L>::value,void >::type* = nullptr>
+diff --git a/examples/all_features/CMakeLists.txt b/examples/all_features/CMakeLists.txt
+index d8b3cfb..4f38170 100644
+--- a/examples/all_features/CMakeLists.txt
++++ b/examples/all_features/CMakeLists.txt
+@@ -16,6 +16,7 @@ set(files_with_output
+     test_cases_and_suites.cpp
+     asserts_used_outside_of_tests.cpp
+     enums.cpp
++    decomposition.cpp
+ )
+ 
+ set(files_all
+diff --git a/examples/all_features/decomposition.cpp b/examples/all_features/decomposition.cpp
+new file mode 100644
+index 0000000..d610cc7
+--- /dev/null
++++ b/examples/all_features/decomposition.cpp
+@@ -0,0 +1,25 @@
++#include <doctest/doctest.h>
++
++class MoveOnly {
++    public:
++        MoveOnly(int iIn) : i(iIn) { }
++        MoveOnly(MoveOnly&&) = default;
++        MoveOnly(const MoveOnly&) = delete;
++        MoveOnly& operator=(MoveOnly&&) = default;
++        MoveOnly& operator=(const MoveOnly&) = default;
++        operator bool() { // NOT const!
++            return i == 42;
++        }
++
++    private:
++        int i;
++};
++
++static MoveOnly genType(bool b) {
++    return MoveOnly(b ? 42 : 0);
++}
++
++TEST_CASE("Move Only Type") {
++    CHECK(genType(true));
++    CHECK(genType(false));
++}
+diff --git a/examples/all_features/test_output/decomposition.cpp.txt b/examples/all_features/test_output/decomposition.cpp.txt
+new file mode 100644
+index 0000000..7eba247
+--- /dev/null
++++ b/examples/all_features/test_output/decomposition.cpp.txt
+@@ -0,0 +1,13 @@
++[doctest] run with "--help" for options
++===============================================================================
++decomposition.cpp(0):
++TEST CASE:  Move Only Type
++
++decomposition.cpp(0): ERROR: CHECK( genType(false) ) is NOT correct!
++  values: CHECK( {?} )
++
++===============================================================================
++[doctest] test cases: 1 | 0 passed | 1 failed |
++[doctest] assertions: 2 | 1 passed | 1 failed |
++[doctest] Status: FAILURE!
++Program code.
+diff --git a/examples/all_features/test_output/decomposition.cpp_junit.txt b/examples/all_features/test_output/decomposition.cpp_junit.txt
+new file mode 100644
+index 0000000..8ab87d4
+--- /dev/null
++++ b/examples/all_features/test_output/decomposition.cpp_junit.txt
+@@ -0,0 +1,14 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<testsuites>
++  <testsuite name="all_features" errors="0" failures="1" tests="2">
++    <testcase classname="decomposition.cpp" name="Move Only Type" status="run">
++      <failure message="{?}" type="CHECK">
++decomposition.cpp(0):
++CHECK( genType(false) ) is NOT correct!
++  values: CHECK( {?} )
++
++      </failure>
++    </testcase>
++  </testsuite>
++</testsuites>
++Program code.
+diff --git a/examples/all_features/test_output/decomposition.cpp_xml.txt b/examples/all_features/test_output/decomposition.cpp_xml.txt
+new file mode 100644
+index 0000000..584f85b
+--- /dev/null
++++ b/examples/all_features/test_output/decomposition.cpp_xml.txt
+@@ -0,0 +1,20 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<doctest binary="all_features">
++  <Options order_by="file" rand_seed="324" first="0" last="4294967295" abort_after="0" subcase_filter_levels="2147483647" case_sensitive="false" no_throw="false" no_skip="false"/>
++  <TestSuite>
++    <TestCase name="Move Only Type" filename="decomposition.cpp" line="0">
++      <Expression success="false" type="CHECK" filename="decomposition.cpp" line="0">
++        <Original>
++          genType(false)
++        </Original>
++        <Expanded>
++          {?}
++        </Expanded>
++      </Expression>
++      <OverallResultsAsserts successes="1" failures="1" test_case_success="false"/>
++    </TestCase>
++  </TestSuite>
++  <OverallResultsAsserts successes="1" failures="1"/>
++  <OverallResultsTestCases successes="0" failures="1"/>
++</doctest>
++Program code.
+diff --git a/examples/all_features/test_output/filter_2.txt b/examples/all_features/test_output/filter_2.txt
+index d4b108f..662a7e2 100644
+--- a/examples/all_features/test_output/filter_2.txt
++++ b/examples/all_features/test_output/filter_2.txt
+@@ -1,6 +1,6 @@
+ [doctest] run with "--help" for options
+ ===============================================================================
+-[doctest] test cases: 0 | 0 passed | 0 failed | 95 skipped
++[doctest] test cases: 0 | 0 passed | 0 failed | 96 skipped
+ [doctest] assertions: 0 | 0 passed | 0 failed |
+ [doctest] Status: SUCCESS!
+ Program code.
+diff --git a/examples/all_features/test_output/filter_2_xml.txt b/examples/all_features/test_output/filter_2_xml.txt
+index 90a2824..cb57096 100644
+--- a/examples/all_features/test_output/filter_2_xml.txt
++++ b/examples/all_features/test_output/filter_2_xml.txt
+@@ -4,6 +4,7 @@
+   <TestSuite>
+     <TestCase name="  Scenario: vectors can be sized and resized" filename="subcases.cpp" line="0" skipped="true"/>
+     <TestCase name="CHECK level of asserts fail the test case but don't abort it" filename="assertion_macros.cpp" line="0" skipped="true"/>
++    <TestCase name="Move Only Type" filename="decomposition.cpp" line="0" skipped="true"/>
+     <TestCase name="Nested - related to https://github.com/doctest/doctest/issues/282"; filename="subcases.cpp" line="0" skipped="true"/>
+     <TestCase name="REQUIRE level of asserts fail and abort the test case - 1" filename="assertion_macros.cpp" line="0" skipped="true"/>
+     <TestCase name="REQUIRE level of asserts fail and abort the test case - 10" filename="assertion_macros.cpp" line="0" skipped="true"/>
+@@ -135,6 +136,6 @@
+     <TestCase name="will end from an unknown exception" filename="coverage_maxout.cpp" line="0" skipped="true"/>
+   </TestSuite>
+   <OverallResultsAsserts successes="0" failures="0"/>
+-  <OverallResultsTestCases successes="0" failures="0" skipped="95"/>
++  <OverallResultsTestCases successes="0" failures="0" skipped="96"/>
+ </doctest>
+ Program code.
diff -Nru doctest-2.4.8~ds/debian/patches/series doctest-2.4.8~ds/debian/patches/series
--- doctest-2.4.8~ds/debian/patches/series	2022-01-14 22:32:17.000000000 +0100
+++ doctest-2.4.8~ds/debian/patches/series	2022-04-21 23:45:26.000000000 +0200
@@ -1 +1,2 @@
 2001_privacy_breach.patch
+0001_Backport_PR_634.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to