mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-22 19:33:29 +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 finish() = 0;
|
||||
virtual ~ChronometerConcept(); // = default;
|
||||
|
||||
ChronometerConcept() = default;
|
||||
ChronometerConcept(ChronometerConcept const&) = default;
|
||||
ChronometerConcept& operator=(ChronometerConcept const&) = default;
|
||||
};
|
||||
template <typename Clock>
|
||||
struct ChronometerModel final : public ChronometerConcept {
|
||||
|
@ -42,6 +42,10 @@ namespace Catch {
|
||||
virtual void call(Chronometer meter) const = 0;
|
||||
virtual callable* clone() const = 0;
|
||||
virtual ~callable(); // = default;
|
||||
|
||||
callable() = default;
|
||||
callable(callable const&) = default;
|
||||
callable& operator=(callable const&) = default;
|
||||
};
|
||||
template <typename Fun>
|
||||
struct model : public callable {
|
||||
|
@ -30,6 +30,10 @@ namespace Detail {
|
||||
template<typename T>
|
||||
struct IGenerator : GeneratorUntypedBase {
|
||||
~IGenerator() override = default;
|
||||
IGenerator() = default;
|
||||
IGenerator(IGenerator const&) = default;
|
||||
IGenerator& operator=(IGenerator const&) = default;
|
||||
|
||||
|
||||
// Returns the current element of the generator
|
||||
//
|
||||
|
@ -36,7 +36,7 @@ namespace Catch {
|
||||
|
||||
namespace Catch {
|
||||
|
||||
IGeneratorTracker::~IGeneratorTracker() {}
|
||||
IGeneratorTracker::~IGeneratorTracker() = default;
|
||||
|
||||
namespace Generators {
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Detail {
|
||||
}
|
||||
} // end namespace Detail
|
||||
|
||||
GeneratorUntypedBase::~GeneratorUntypedBase() {}
|
||||
GeneratorUntypedBase::~GeneratorUntypedBase() = default;
|
||||
|
||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||
return getResultCapture().acquireGeneratorTracker( lineInfo );
|
||||
|
@ -16,11 +16,17 @@ namespace Catch {
|
||||
class GeneratorUntypedBase {
|
||||
public:
|
||||
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
|
||||
//
|
||||
// Returns true iff the move succeeded (and a valid element
|
||||
// can be retrieved).
|
||||
//
|
||||
// Returns true iff the move succeeded (and a valid element
|
||||
// can be retrieved).
|
||||
virtual bool next() = 0;
|
||||
};
|
||||
using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>;
|
||||
@ -28,7 +34,7 @@ namespace Catch {
|
||||
} // namespace Generators
|
||||
|
||||
struct IGeneratorTracker {
|
||||
virtual ~IGeneratorTracker();
|
||||
virtual ~IGeneratorTracker(); // = default;
|
||||
virtual auto hasGenerator() const -> bool = 0;
|
||||
virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0;
|
||||
virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0;
|
||||
|
@ -43,9 +43,13 @@ namespace Catch {
|
||||
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
|
||||
// complain if it's not here :-(
|
||||
virtual ~ITransientExpression();
|
||||
virtual ~ITransientExpression(); // = default;
|
||||
|
||||
bool m_isBinaryExpression;
|
||||
bool m_result;
|
||||
|
@ -17,8 +17,13 @@ namespace Matchers {
|
||||
class MatcherUntypedBase {
|
||||
public:
|
||||
MatcherUntypedBase() = default;
|
||||
|
||||
MatcherUntypedBase(MatcherUntypedBase const&) = default;
|
||||
MatcherUntypedBase(MatcherUntypedBase&&) = default;
|
||||
|
||||
MatcherUntypedBase& operator = (MatcherUntypedBase const&) = delete;
|
||||
MatcherUntypedBase& operator = (MatcherUntypedBase&&) = delete;
|
||||
|
||||
std::string toString() const;
|
||||
|
||||
protected:
|
||||
|
@ -18,7 +18,14 @@
|
||||
namespace Catch {
|
||||
namespace Matchers {
|
||||
struct MatcherGenericBase : MatcherUntypedBase {
|
||||
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 {
|
||||
ThrowOnCopyOrMoveMatcher() = default;
|
||||
[[noreturn]]
|
||||
ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher const&) {
|
||||
ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher const&): Catch::Matchers::MatcherGenericBase() {
|
||||
throw MatcherWasMovedOrCopied();
|
||||
}
|
||||
[[noreturn]]
|
||||
ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher &&) {
|
||||
ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher &&): Catch::Matchers::MatcherGenericBase() {
|
||||
throw MatcherWasMovedOrCopied();
|
||||
}
|
||||
ThrowOnCopyOrMoveMatcher& operator=(ThrowOnCopyOrMoveMatcher const&) {
|
||||
|
Loading…
Reference in New Issue
Block a user