Using latest GCC 9 one can see (with default -Wdeprecated-copy): [ 113s] In file included from ../../include/cppunit/TestCase.h:6, [ 113s] from ../../include/cppunit/TestCaller.h:5, [ 113s] from ../../include/cppunit/extensions/HelperMacros.h:9, [ 113s] from OrthodoxTest.h:4, [ 113s] from OrthodoxTest.cpp:2: [ 113s] ../../include/cppunit/extensions/Orthodox.h: In instantiation of 'void CppUnit::Orthodox<ClassUnderTest>::runTest() [with ClassUnderTest = OrthodoxTest::ValueBadAssignment]': [ 113s] ../../include/cppunit/extensions/Orthodox.h:56:38: required from here [ 113s] ../../include/cppunit/extensions/Orthodox.h:77:23: error: implicitly-declared 'constexpr OrthodoxTest::ValueBadAssignment::ValueBadAssignment(const OrthodoxTest::ValueBadAssignment&)' is deprecated [-Werror=deprecated-copy] [ 113s] 77 | CPPUNIT_ASSERT (c == call (a)); [ 113s] ../../include/cppunit/TestAssert.h:240:37: note: in definition of macro 'CPPUNIT_ASSERT' [ 113s] 240 | ( CPPUNIT_NS::Asserter::failIf( !(condition), \ [ 113s] | ^~~~~~~~~ [ 113s] In file included from OrthodoxTest.cpp:2: [ 113s] OrthodoxTest.h:159:25: note: because 'OrthodoxTest::ValueBadAssignment' has user-provided 'OrthodoxTest::ValueBadAssignment& OrthodoxTest::ValueBadAssignment::operator=(const OrthodoxTest::ValueBadAssignment&)' [ 113s] 159 | ValueBadAssignment &operator =( const ValueBadAssignment & ) [ 113s] | ^~~~~~~~ [ 113s] In file included from OrthodoxTest.cpp:3: [ 113s] ../../include/cppunit/extensions/Orthodox.h:87:63: note: initializing argument 1 of 'ClassUnderTest CppUnit::Orthodox<ClassUnderTest>::call(ClassUnderTest) [with ClassUnderTest = OrthodoxTest::ValueBadAssignment]' [ 113s] 87 | ClassUnderTest Orthodox<ClassUnderTest>::call (ClassUnderTest object) [ 113s] | ~~~~~~~~~~~~~~~^~~~~~ [ 113s] In file included from ../../include/cppunit/TestCase.h:6, [ 113s] from ../../include/cppunit/TestCaller.h:5, [ 113s] from ../../include/cppunit/extensions/HelperMacros.h:9, [ 113s] from OrthodoxTest.h:4, [ 113s] from OrthodoxTest.cpp:2: [ 113s] ../../include/cppunit/extensions/Orthodox.h:80:23: error: implicitly-declared 'constexpr OrthodoxTest::ValueBadAssignment::ValueBadAssignment(const OrthodoxTest::ValueBadAssignment&)' is deprecated [-Werror=deprecated-copy] [ 113s] 80 | CPPUNIT_ASSERT (c == call (b)); [ 113s] ../../include/cppunit/TestAssert.h:240:37: note: in definition of macro 'CPPUNIT_ASSERT' [ 113s] 240 | ( CPPUNIT_NS::Asserter::failIf( !(condition), \ [ 113s] | ^~~~~~~~~ [ 113s] In file included from OrthodoxTest.cpp:2: [ 113s] OrthodoxTest.h:159:25: note: because 'OrthodoxTest::ValueBadAssignment' has user-provided 'OrthodoxTest::ValueBadAssignment& OrthodoxTest::ValueBadAssignment::operator=(const OrthodoxTest::ValueBadAssignment&)' [ 113s] 159 | ValueBadAssignment &operator =( const ValueBadAssignment & ) [ 113s] | ^~~~~~~~ [ 113s] In file included from OrthodoxTest.cpp:3: [ 113s] ../../include/cppunit/extensions/Orthodox.h:87:63: note: initializing argument 1 of 'ClassUnderTest CppUnit::Orthodox<ClassUnderTest>::call(ClassUnderTest) [with ClassUnderTest = OrthodoxTest::ValueBadAssignment]' [ 113s] 87 | ClassUnderTest Orthodox<ClassUnderTest>::call (ClassUnderTest object) [ 113s] | ~~~~~~~~~~~~~~~^~~~~~ [ 113s] ../../include/cppunit/extensions/Orthodox.h: In instantiation of 'void CppUnit::Orthodox<ClassUnderTest>::runTest() [with ClassUnderTest = OrthodoxTest::ValueBadCall]': [ 113s] ../../include/cppunit/extensions/Orthodox.h:56:38: required from here [ 113s] ../../include/cppunit/extensions/Orthodox.h:65:5: error: implicitly-declared 'OrthodoxTest::ValueBadCall& OrthodoxTest::ValueBadCall::operator=(const OrthodoxTest::ValueBadCall&)' is deprecated [-Werror=deprecated-copy] [ 113s] 65 | b.operator= (a.operator! ()); [ 113s] | ^ [ 113s] In file included from OrthodoxTest.cpp:2: [ 113s] OrthodoxTest.h:136:5: note: because 'OrthodoxTest::ValueBadCall' has user-provided 'OrthodoxTest::ValueBadCall::ValueBadCall(const OrthodoxTest::ValueBadCall&)' [ 113s] 136 | ValueBadCall( const ValueBadCall & ) : Value() [ 113s] | ^~~~~~~~~~~~ [ 113s] In file included from OrthodoxTest.cpp:3: [ 113s] ../../include/cppunit/extensions/Orthodox.h:69:7: error: implicitly-declared 'OrthodoxTest::ValueBadCall& OrthodoxTest::ValueBadCall::operator=(const OrthodoxTest::ValueBadCall&)' is deprecated [-Werror=deprecated-copy] [ 113s] 69 | b = !!a; [ 113s] | ~~^~~~~ [ 113s] In file included from OrthodoxTest.cpp:2: [ 113s] OrthodoxTest.h:136:5: note: because 'OrthodoxTest::ValueBadCall' has user-provided 'OrthodoxTest::ValueBadCall::ValueBadCall(const OrthodoxTest::ValueBadCall&)' [ 113s] 136 | ValueBadCall( const ValueBadCall & ) : Value() [ 113s] | ^~~~~~~~~~~~ [ 113s] In file included from OrthodoxTest.cpp:3: [ 113s] ../../include/cppunit/extensions/Orthodox.h:73:7: error: implicitly-declared 'OrthodoxTest::ValueBadCall& OrthodoxTest::ValueBadCall::operator=(const OrthodoxTest::ValueBadCall&)' is deprecated [-Werror=deprecated-copy] [ 113s] 73 | b = !a; [ 113s] | ~~^~~~ [ 113s] In file included from OrthodoxTest.cpp:2: [ 114s] OrthodoxTest.h:136:5: note: because 'OrthodoxTest::ValueBadCall' has user-provided 'OrthodoxTest::ValueBadCall::ValueBadCall(const OrthodoxTest::ValueBadCall&)' [ 114s] 136 | ValueBadCall( const ValueBadCall & ) : Value() [ 114s] | ^~~~~~~~~~~~ [ 114s] In file included from OrthodoxTest.cpp:3: [ 114s] ../../include/cppunit/extensions/Orthodox.h:76:7: error: implicitly-declared 'OrthodoxTest::ValueBadCall& OrthodoxTest::ValueBadCall::operator=(const OrthodoxTest::ValueBadCall&)' is deprecated [-Werror=deprecated-copy] [ 114s] 76 | c = a; [ 114s] | ~~^~~ [ 114s] In file included from OrthodoxTest.cpp:2: [ 114s] OrthodoxTest.h:136:5: note: because 'OrthodoxTest::ValueBadCall' has user-provided 'OrthodoxTest::ValueBadCall::ValueBadCall(const OrthodoxTest::ValueBadCall&)' [ 114s] 136 | ValueBadCall( const ValueBadCall & ) : Value() [ 114s] | ^~~~~~~~~~~~ [ 114s] In file included from OrthodoxTest.cpp:3: [ 114s] ../../include/cppunit/extensions/Orthodox.h:79:7: error: implicitly-declared 'OrthodoxTest::ValueBadCall& OrthodoxTest::ValueBadCall::operator=(const OrthodoxTest::ValueBadCall&)' is deprecated [-Werror=deprecated-copy] [ 114s] 79 | c = b; [ 114s] | ~~^~~ [ 114s] In file included from OrthodoxTest.cpp:2: [ 114s] OrthodoxTest.h:136:5: note: because 'OrthodoxTest::ValueBadCall' has user-provided 'OrthodoxTest::ValueBadCall::ValueBadCall(const OrthodoxTest::ValueBadCall&)' [ 114s] 136 | ValueBadCall( const ValueBadCall & ) : Value() [ 114s] | ^~~~~~~~~~~~ [ 114s] In file included from ../../include/cppunit/TestCase.h:6, [ 114s] from ../../include/cppunit/TestCaller.h:5, [ 114s] from ../../include/cppunit/extensions/HelperMacros.h:9, [ 114s] from OrthodoxTest.h:4, [ 114s] from OrthodoxTest.cpp:2: [ 114s] ../../include/cppunit/extensions/Orthodox.h: In instantiation of 'void CppUnit::Orthodox<ClassUnderTest>::runTest() [with ClassUnderTest = OrthodoxTest::Value]': [ 114s] ../../include/cppunit/extensions/Orthodox.h:56:38: required from here [ 114s] ../../include/cppunit/extensions/Orthodox.h:77:23: error: implicitly-declared 'constexpr OrthodoxTest::Value::Value(const OrthodoxTest::Value&)' is deprecated [-Werror=deprecated-copy] [ 114s] 77 | CPPUNIT_ASSERT (c == call (a)); [ 114s] ../../include/cppunit/TestAssert.h:240:37: note: in definition of macro 'CPPUNIT_ASSERT' [ 114s] 240 | ( CPPUNIT_NS::Asserter::failIf( !(condition), \ [ 114s] | ^~~~~~~~~ [ 114s] In file included from OrthodoxTest.cpp:2: [ 114s] OrthodoxTest.h:41:12: note: because 'OrthodoxTest::Value' has user-provided 'OrthodoxTest::Value& OrthodoxTest::Value::operator=(const OrthodoxTest::Value&)' [ 114s] 41 | Value& operator= ( const Value& v ) [ 114s] | ^~~~~~~~ [ 114s] In file included from OrthodoxTest.cpp:3: [ 114s] ../../include/cppunit/extensions/Orthodox.h:87:63: note: initializing argument 1 of 'ClassUnderTest CppUnit::Orthodox<ClassUnderTest>::call(ClassUnderTest) [with ClassUnderTest = OrthodoxTest::Value]' [ 114s] 87 | ClassUnderTest Orthodox<ClassUnderTest>::call (ClassUnderTest object) [ 114s] | ~~~~~~~~~~~~~~~^~~~~~ [ 114s] In file included from ../../include/cppunit/TestCase.h:6, [ 114s] from ../../include/cppunit/TestCaller.h:5, [ 114s] from ../../include/cppunit/extensions/HelperMacros.h:9, [ 114s] from OrthodoxTest.h:4, [ 114s] from OrthodoxTest.cpp:2: [ 114s] ../../include/cppunit/extensions/Orthodox.h:80:23: error: implicitly-declared 'constexpr OrthodoxTest::Value::Value(const OrthodoxTest::Value&)' is deprecated [-Werror=deprecated-copy] [ 114s] 80 | CPPUNIT_ASSERT (c == call (b)); [ 114s] ../../include/cppunit/TestAssert.h:240:37: note: in definition of macro 'CPPUNIT_ASSERT' [ 114s] 240 | ( CPPUNIT_NS::Asserter::failIf( !(condition), \ [ 114s] | ^~~~~~~~~ [ 114s] In file included from OrthodoxTest.cpp:2: [ 114s] OrthodoxTest.h:41:12: note: because 'OrthodoxTest::Value' has user-provided 'OrthodoxTest::Value& OrthodoxTest::Value::operator=(const OrthodoxTest::Value&)' [ 114s] 41 | Value& operator= ( const Value& v ) [ 114s] | ^~~~~~~~ [ 114s] In file included from OrthodoxTest.cpp:3: [ 114s] ../../include/cppunit/extensions/Orthodox.h:87:63: note: initializing argument 1 of 'ClassUnderTest CppUnit::Orthodox<ClassUnderTest>::call(ClassUnderTest) [with ClassUnderTest = OrthodoxTest::Value]' [ 114s] 87 | ClassUnderTest Orthodox<ClassUnderTest>::call (ClassUnderTest object) [ 114s] | ~~~~~~~~~~~~~~~^~~~~~ [ 114s] ../../include/cppunit/extensions/Orthodox.h: In instantiation of 'ClassUnderTest CppUnit::Orthodox<ClassUnderTest>::call(ClassUnderTest) [with ClassUnderTest = OrthodoxTest::ValueBadAssignment]': [ 114s] ../../include/cppunit/extensions/Orthodox.h:77:5: required from 'void CppUnit::Orthodox<ClassUnderTest>::runTest() [with ClassUnderTest = OrthodoxTest::ValueBadAssignment]' [ 114s] ../../include/cppunit/extensions/Orthodox.h:56:38: required from here [ 114s] ../../include/cppunit/extensions/Orthodox.h:89:12: error: implicitly-declared 'constexpr OrthodoxTest::ValueBadAssignment::ValueBadAssignment(const OrthodoxTest::ValueBadAssignment&)' is deprecated [-Werror=deprecated-copy] [ 114s] 89 | return object; [ 114s] | ^~~~~~ [ 114s] In file included from OrthodoxTest.cpp:2: [ 114s] OrthodoxTest.h:159:25: note: because 'OrthodoxTest::ValueBadAssignment' has user-provided 'OrthodoxTest::ValueBadAssignment& OrthodoxTest::ValueBadAssignment::operator=(const OrthodoxTest::ValueBadAssignment&)' [ 114s] 159 | ValueBadAssignment &operator =( const ValueBadAssignment & ) [ 114s] | ^~~~~~~~ [ 114s] In file included from OrthodoxTest.cpp:3: [ 114s] ../../include/cppunit/extensions/Orthodox.h: In instantiation of 'ClassUnderTest CppUnit::Orthodox<ClassUnderTest>::call(ClassUnderTest) [with ClassUnderTest = OrthodoxTest::Value]': [ 114s] ../../include/cppunit/extensions/Orthodox.h:77:5: required from 'void CppUnit::Orthodox<ClassUnderTest>::runTest() [with ClassUnderTest = OrthodoxTest::Value]' [ 114s] ../../include/cppunit/extensions/Orthodox.h:56:38: required from here [ 114s] ../../include/cppunit/extensions/Orthodox.h:89:12: error: implicitly-declared 'constexpr OrthodoxTest::Value::Value(const OrthodoxTest::Value&)' is deprecated [-Werror=deprecated-copy] [ 114s] 89 | return object; [ 114s] | ^~~~~~ [ 114s] In file included from OrthodoxTest.cpp:2: [ 114s] OrthodoxTest.h:41:12: note: because 'OrthodoxTest::Value' has user-provided 'OrthodoxTest::Value& OrthodoxTest::Value::operator=(const OrthodoxTest::Value&)' [ 114s] 41 | Value& operator= ( const Value& v ) [ 114s] | ^~~~~~~~ [ 115s] g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../include -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -Werror -Wall -Wextra -pedantic -c -o SubclassedTestCase.o SubclassedTestCase.cpp [ 116s] g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../include -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -Werror -Wall -Wextra -pedantic -c -o TestAssertTest.o TestAssertTest.cpp [ 117s] g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../include -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -Werror -Wall -Wextra -pedantic -c -o TestCallerTest.o TestCallerTest.cpp [ 119s] g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../include -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -Werror -Wall -Wextra -pedantic -c -o TestCaseTest.o TestCaseTest.cpp
@Stephan Bergmann, any opinion here ?
Yes, that likely needs fixing, probably similarly to <https://gerrit.libreoffice.org/plugins/gitiles/cppunit/+/4f5cd3b486afb9c7be1903252b4ae3787137a454%5E%21> "Avoid GCC 9 -Wdeprecated-copy ". (I had only fixed those -Wdeprecated-copy in CppUnit source code that were encountered when compiling LibreOffice test code that uses CppUnit, and that TestSuiteBuilderContextBase was the only issue there.)
(In reply to Stephan Bergmann from comment #2) > Yes, that likely needs fixing, probably similarly to > <https://gerrit.libreoffice.org/plugins/gitiles/cppunit/+/ > 4f5cd3b486afb9c7be1903252b4ae3787137a454%5E%21> "Avoid GCC 9 > -Wdeprecated-copy > ". (I had only fixed those -Wdeprecated-copy in CppUnit source code that > were encountered when compiling LibreOffice test code that uses CppUnit, and > that TestSuiteBuilderContextBase was the only issue there.) Yes, that's exactly very similar issue. Can you please prepare a fix for it? Thanks.
There's a patch candidate, can you please merge it: diff --git a/examples/cppunittest/OrthodoxTest.h b/examples/cppunittest/OrthodoxTest.h index 8fc2a08..3781415 100644 --- a/examples/cppunittest/OrthodoxTest.h +++ b/examples/cppunittest/OrthodoxTest.h @@ -37,6 +36,7 @@ private: { public: Value( int value =0 ) : m_value( value ) {} + Value( const Value &other) : m_value ( other.m_value ) {} Value& operator= ( const Value& v ) { @@ -143,6 +143,12 @@ private: { return ValueBadCall( -1 - m_value ); } + + ValueBadCall &operator =( const ValueBadCall &other) + { + m_value = other.m_value; + return *this; + } }; @@ -150,6 +156,9 @@ private: { public: ValueBadAssignment( int value =0 ) : Value( value ) {} + ValueBadAssignment( const ValueBadAssignment &other): Value (other.m_value) + { + } ValueBadAssignment operator !() {
@Markus Mohrhard, how patches can be submitted to cppunit? gerrit ?
May I please remind the patch candidate?
Shouldn't this be already fixed by: https://cgit.freedesktop.org/libreoffice/cppunit/commit/?id=4f5cd3b486afb9c7be1903252b4ae3787137a454
(In reply to Tomáš Chvátal from comment #7) > Shouldn't this be already fixed by: > > https://cgit.freedesktop.org/libreoffice/cppunit/commit/ > ?id=4f5cd3b486afb9c7be1903252b4ae3787137a454 I guess so, closing as fixed.
(In reply to Martin Liška from comment #8) > (In reply to Tomáš Chvátal from comment #7) > > Shouldn't this be already fixed by: > > > > https://cgit.freedesktop.org/libreoffice/cppunit/commit/ > > ?id=4f5cd3b486afb9c7be1903252b4ae3787137a454 > > I guess so, closing as fixed. So no, similar changes need to be done as mentioned in: https://bugs.documentfoundation.org/show_bug.cgi?id=122605#c3
(In reply to Martin Liška from comment #9) > (In reply to Martin Liška from comment #8) > > (In reply to Tomáš Chvátal from comment #7) > > > Shouldn't this be already fixed by: > > > > > > https://cgit.freedesktop.org/libreoffice/cppunit/commit/ > > > ?id=4f5cd3b486afb9c7be1903252b4ae3787137a454 > > > > I guess so, closing as fixed. > > So no, similar changes need to be done as mentioned in: > https://bugs.documentfoundation.org/show_bug.cgi?id=122605#c3 Would you like to provide a patch for it ?
(In reply to Xisco Faulí from comment #10) > (In reply to Martin Liška from comment #9) > > (In reply to Martin Liška from comment #8) > > > (In reply to Tomáš Chvátal from comment #7) > > > > Shouldn't this be already fixed by: > > > > > > > > https://cgit.freedesktop.org/libreoffice/cppunit/commit/ > > > > ?id=4f5cd3b486afb9c7be1903252b4ae3787137a454 > > > > > > I guess so, closing as fixed. > > > > So no, similar changes need to be done as mentioned in: > > https://bugs.documentfoundation.org/show_bug.cgi?id=122605#c3 > > Would you like to provide a patch for it ? Already done: https://gerrit.libreoffice.org/#/c/71573/
A polite ping to Martin Liška: Is this bug fixed? if so, could you please close it as RESOLVED FIXED ? Otherwise, Could you please explain what's missing? Thanks
Yep, I'm closing that as resolved.