Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/onqtam/doctest.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan <29021710+Saalvage@users.noreply.github.com>2022-04-18 18:45:33 +0300
committerGitHub <noreply@github.com>2022-04-18 18:45:33 +0300
commitce13bc44b99c87e918b98bdadb17008d2dd54d55 (patch)
tree13f524075c759989cf6d99fa717db560f25d3aeb /doctest
parent1cf1b2482d29ee87ca206b86f247a92c90e11b0a (diff)
Fix move-only types failing to decompose correctly (#634)
* Fix application of move semantics to allow for decomposition of move-only types * Add regression test * Remove shadowing to appease compiler gods * Oops
Diffstat (limited to 'doctest')
-rw-r--r--doctest/doctest.h12
-rw-r--r--doctest/parts/doctest_fwd.h6
2 files changed, 9 insertions, 9 deletions
diff --git a/doctest/doctest.h b/doctest/doctest.h
index 30315de8..d576bbd5 100644
--- a/doctest/doctest.h
+++ b/doctest/doctest.h
@@ -408,9 +408,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
@@ -1391,7 +1391,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() {
@@ -1465,8 +1465,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 23f75ba4..03162150 100644
--- a/doctest/parts/doctest_fwd.h
+++ b/doctest/parts/doctest_fwd.h
@@ -1388,7 +1388,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() {
@@ -1462,8 +1462,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>