From f1e068d5c577a019f1f6c199f2e3f21859c45d13 Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Thu, 6 Nov 2025 10:36:07 -0800 Subject: [PATCH] Fix ParamIteratorInterface copy constructor defaulting --- googletest/include/gtest/internal/gtest-param-util.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h index a092a86ad..f2723af25 100644 --- a/googletest/include/gtest/internal/gtest-param-util.h +++ b/googletest/include/gtest/internal/gtest-param-util.h @@ -99,6 +99,7 @@ class ParamGenerator; template class ParamIteratorInterface { public: + ParamIteratorInterface() = default; virtual ~ParamIteratorInterface() = default; // A pointer to the base generator instance. // Used only for the purposes of iterator comparison @@ -121,6 +122,9 @@ class ParamIteratorInterface { // element in the sequence generated by the generator. // Used for implementing ParamGenerator::operator==(). virtual bool Equals(const ParamIteratorInterface& other) const = 0; + protected: + // Make available for subclasses to use to implement Clone(). + ParamIteratorInterface(const ParamIteratorInterface&) = default; }; // Class iterating over elements provided by an implementation of @@ -842,7 +846,7 @@ class CartesianProductGenerator template class IteratorImpl; template - class IteratorImpl> + class IteratorImpl> final : public ParamIteratorInterface { public: IteratorImpl(const ParamGeneratorInterface* base, @@ -854,7 +858,7 @@ class CartesianProductGenerator current_(is_end ? end_ : begin_) { ComputeCurrentValue(); } - ~IteratorImpl() override = default; + ~IteratorImpl() final = default; const ParamGeneratorInterface* BaseGenerator() const override { return base_; @@ -898,6 +902,8 @@ class CartesianProductGenerator } private: + IteratorImpl(const IteratorImpl&) = default; + template void AdvanceIfEnd() { if (std::get(current_) != std::get(end_)) return;