Menu

#58 Compilation of tests with g++ -std=c++11 can warn about auto_ptr

open
nobody
None
5
2014-11-10
2014-11-10
Ron Fox
No

If I compile a file with more than one class derived from CppUnit::TestFixture under gcc/g++ 4.7.2 (Debian 4.7.2-5) on Debian Wheezy (cppunit-1.12-1). The CPPUNIT_TEST_SUITE_END macro invocation in all but the first class will warn that auto_ptr is deprecated.

Workaround choice of:
1. Break up compilation units so that only one test fixture is in each file.
2. Add -Wdeprecated-declarations to the compilation flags.

Desired solution:
Conditionally use unique_ptr or shared_ptr as appropriate if the compilation standard level is at c++-11.0 or higher(?) (checking the value of __cplusplus).

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.