mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Explicitly default smfs when relevant to avoid Wdeprecated-copy-dtor
This commit is contained in:
parent
579dcd1a76
commit
03ef6b9f9a
@ -23,6 +23,10 @@ namespace Catch {
|
|||||||
virtual void start() = 0;
|
virtual void start() = 0;
|
||||||
virtual void finish() = 0;
|
virtual void finish() = 0;
|
||||||
virtual ~ChronometerConcept(); // = default;
|
virtual ~ChronometerConcept(); // = default;
|
||||||
|
|
||||||
|
ChronometerConcept() = default;
|
||||||
|
ChronometerConcept(ChronometerConcept const&) = default;
|
||||||
|
ChronometerConcept& operator=(ChronometerConcept const&) = default;
|
||||||
};
|
};
|
||||||
template <typename Clock>
|
template <typename Clock>
|
||||||
struct ChronometerModel final : public ChronometerConcept {
|
struct ChronometerModel final : public ChronometerConcept {
|
||||||
|
@ -42,6 +42,10 @@ namespace Catch {
|
|||||||
virtual void call(Chronometer meter) const = 0;
|
virtual void call(Chronometer meter) const = 0;
|
||||||
virtual callable* clone() const = 0;
|
virtual callable* clone() const = 0;
|
||||||
virtual ~callable(); // = default;
|
virtual ~callable(); // = default;
|
||||||
|
|
||||||
|
callable() = default;
|
||||||
|
callable(callable const&) = default;
|
||||||
|
callable& operator=(callable const&) = default;
|
||||||
};
|
};
|
||||||
template <typename Fun>
|
template <typename Fun>
|
||||||
struct model : public callable {
|
struct model : public callable {
|
||||||
|
@ -30,6 +30,10 @@ namespace Detail {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct IGenerator : GeneratorUntypedBase {
|
struct IGenerator : GeneratorUntypedBase {
|
||||||
~IGenerator() override = default;
|
~IGenerator() override = default;
|
||||||
|
IGenerator() = default;
|
||||||
|
IGenerator(IGenerator const&) = default;
|
||||||
|
IGenerator& operator=(IGenerator const&) = default;
|
||||||
|
|
||||||
|
|
||||||
// Returns the current element of the generator
|
// Returns the current element of the generator
|
||||||
//
|
//
|
||||||
|
@ -36,7 +36,7 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
IGeneratorTracker::~IGeneratorTracker() {}
|
IGeneratorTracker::~IGeneratorTracker() = default;
|
||||||
|
|
||||||
namespace Generators {
|
namespace Generators {
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ namespace Detail {
|
|||||||
}
|
}
|
||||||
} // end namespace Detail
|
} // end namespace Detail
|
||||||
|
|
||||||
GeneratorUntypedBase::~GeneratorUntypedBase() {}
|
GeneratorUntypedBase::~GeneratorUntypedBase() = default;
|
||||||
|
|
||||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||||
return getResultCapture().acquireGeneratorTracker( lineInfo );
|
return getResultCapture().acquireGeneratorTracker( lineInfo );
|
||||||
|
@ -16,11 +16,17 @@ namespace Catch {
|
|||||||
class GeneratorUntypedBase {
|
class GeneratorUntypedBase {
|
||||||
public:
|
public:
|
||||||
GeneratorUntypedBase() = default;
|
GeneratorUntypedBase() = default;
|
||||||
virtual ~GeneratorUntypedBase();
|
// Generation of copy ops is deprecated (and Clang will complain)
|
||||||
|
// if there is a user destructor defined
|
||||||
|
GeneratorUntypedBase(GeneratorUntypedBase const&) = default;
|
||||||
|
GeneratorUntypedBase& operator=(GeneratorUntypedBase const&) = default;
|
||||||
|
|
||||||
|
virtual ~GeneratorUntypedBase(); // = default;
|
||||||
|
|
||||||
// Attempts to move the generator to the next element
|
// Attempts to move the generator to the next element
|
||||||
//
|
//
|
||||||
// Returns true iff the move succeeded (and a valid element
|
// Returns true iff the move succeeded (and a valid element
|
||||||
// can be retrieved).
|
// can be retrieved).
|
||||||
virtual bool next() = 0;
|
virtual bool next() = 0;
|
||||||
};
|
};
|
||||||
using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>;
|
using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>;
|
||||||
@ -28,7 +34,7 @@ namespace Catch {
|
|||||||
} // namespace Generators
|
} // namespace Generators
|
||||||
|
|
||||||
struct IGeneratorTracker {
|
struct IGeneratorTracker {
|
||||||
virtual ~IGeneratorTracker();
|
virtual ~IGeneratorTracker(); // = default;
|
||||||
virtual auto hasGenerator() const -> bool = 0;
|
virtual auto hasGenerator() const -> bool = 0;
|
||||||
virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0;
|
virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0;
|
||||||
virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0;
|
virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0;
|
||||||
|
@ -43,9 +43,13 @@ namespace Catch {
|
|||||||
m_result( result )
|
m_result( result )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
ITransientExpression() = default;
|
||||||
|
ITransientExpression(ITransientExpression const&) = default;
|
||||||
|
ITransientExpression& operator=(ITransientExpression const&) = default;
|
||||||
|
|
||||||
// We don't actually need a virtual destructor, but many static analysers
|
// We don't actually need a virtual destructor, but many static analysers
|
||||||
// complain if it's not here :-(
|
// complain if it's not here :-(
|
||||||
virtual ~ITransientExpression();
|
virtual ~ITransientExpression(); // = default;
|
||||||
|
|
||||||
bool m_isBinaryExpression;
|
bool m_isBinaryExpression;
|
||||||
bool m_result;
|
bool m_result;
|
||||||
|
@ -17,8 +17,13 @@ namespace Matchers {
|
|||||||
class MatcherUntypedBase {
|
class MatcherUntypedBase {
|
||||||
public:
|
public:
|
||||||
MatcherUntypedBase() = default;
|
MatcherUntypedBase() = default;
|
||||||
|
|
||||||
MatcherUntypedBase(MatcherUntypedBase const&) = default;
|
MatcherUntypedBase(MatcherUntypedBase const&) = default;
|
||||||
|
MatcherUntypedBase(MatcherUntypedBase&&) = default;
|
||||||
|
|
||||||
MatcherUntypedBase& operator = (MatcherUntypedBase const&) = delete;
|
MatcherUntypedBase& operator = (MatcherUntypedBase const&) = delete;
|
||||||
|
MatcherUntypedBase& operator = (MatcherUntypedBase&&) = delete;
|
||||||
|
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -18,7 +18,14 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace Matchers {
|
namespace Matchers {
|
||||||
struct MatcherGenericBase : MatcherUntypedBase {
|
struct MatcherGenericBase : MatcherUntypedBase {
|
||||||
|
MatcherGenericBase() = default;
|
||||||
virtual ~MatcherGenericBase(); // = default;
|
virtual ~MatcherGenericBase(); // = default;
|
||||||
|
|
||||||
|
MatcherGenericBase(MatcherGenericBase&) = default;
|
||||||
|
MatcherGenericBase(MatcherGenericBase&&) = default;
|
||||||
|
|
||||||
|
MatcherGenericBase& operator=(MatcherGenericBase const&) = delete;
|
||||||
|
MatcherGenericBase& operator=(MatcherGenericBase&&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -893,11 +893,11 @@ namespace { namespace MatchersTests {
|
|||||||
struct ThrowOnCopyOrMoveMatcher : Catch::Matchers::MatcherGenericBase {
|
struct ThrowOnCopyOrMoveMatcher : Catch::Matchers::MatcherGenericBase {
|
||||||
ThrowOnCopyOrMoveMatcher() = default;
|
ThrowOnCopyOrMoveMatcher() = default;
|
||||||
[[noreturn]]
|
[[noreturn]]
|
||||||
ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher const&) {
|
ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher const&): Catch::Matchers::MatcherGenericBase() {
|
||||||
throw MatcherWasMovedOrCopied();
|
throw MatcherWasMovedOrCopied();
|
||||||
}
|
}
|
||||||
[[noreturn]]
|
[[noreturn]]
|
||||||
ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher &&) {
|
ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher &&): Catch::Matchers::MatcherGenericBase() {
|
||||||
throw MatcherWasMovedOrCopied();
|
throw MatcherWasMovedOrCopied();
|
||||||
}
|
}
|
||||||
ThrowOnCopyOrMoveMatcher& operator=(ThrowOnCopyOrMoveMatcher const&) {
|
ThrowOnCopyOrMoveMatcher& operator=(ThrowOnCopyOrMoveMatcher const&) {
|
||||||
|
Loading…
Reference in New Issue
Block a user