Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Unittest won't compile with C++17 #329

@NeroBurner

Description

@NeroBurner

Tried on Ubuntu 18.04 amd64 with C++17 enabled, compiled without GFLAGS at master abce788

cmake: renamed GFLAGS_NAMESPACE to GLOG_GFLAGS_NAMESPACE

the auto_ptr could be replaced with a unique_ptr.
The throw errors need to be fixed in googletest (I think). Maybe update the bundled googletest files?

Scanning dependencies of target logging_unittest
In file included from /usr/src/app/src/demangle_unittest.cc:41:0:
/usr/src/app/src/googletest.h:581:33: error: ISO C++1z does not allow dynamic exception specifications
 void* operator new(size_t size) throw(std::bad_alloc) {
                                 ^~~~~
/usr/src/app/src/googletest.h:588:35: error: ISO C++1z does not allow dynamic exception specifications
 void* operator new[](size_t size) throw(std::bad_alloc) {
                                   ^~~~~
[ 68%] Building CXX object CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o
[ 68%] Built target signalhandler_unittest
Scanning dependencies of target symbolize_unittest
[ 72%] Building CXX object CMakeFiles/symbolize_unittest.dir/src/symbolize_unittest.cc.o
CMakeFiles/demangle_unittest.dir/build.make:62: recipe for target 'CMakeFiles/demangle_unittest.dir/src/demangle_unittest.cc.o' failed
make[2]: *** [CMakeFiles/demangle_unittest.dir/src/demangle_unittest.cc.o] Error 1
CMakeFiles/Makefile2:1042: recipe for target 'CMakeFiles/demangle_unittest.dir/all' failed
make[1]: *** [CMakeFiles/demangle_unittest.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
In file included from /usr/src/app/src/stl_logging_unittest.cc:63:0:
/usr/src/app/src/googletest.h:581:33: error: ISO C++1z does not allow dynamic exception specifications
 void* operator new(size_t size) throw(std::bad_alloc) {
                                 ^~~~~
/usr/src/app/src/googletest.h:588:35: error: ISO C++1z does not allow dynamic exception specifications
 void* operator new[](size_t size) throw(std::bad_alloc) {
                                   ^~~~~
In file included from /usr/src/app/src/symbolize_unittest.cc:41:0:
/usr/src/app/src/googletest.h:581:33: error: ISO C++1z does not allow dynamic exception specifications
 void* operator new(size_t size) throw(std::bad_alloc) {
                                 ^~~~~
/usr/src/app/src/googletest.h:588:35: error: ISO C++1z does not allow dynamic exception specifications
 void* operator new[](size_t size) throw(std::bad_alloc) {
                                   ^~~~~
/usr/src/app/src/symbolize_unittest.cc: In function 'void* inline_func()':
/usr/src/app/src/symbolize_unittest.cc:314:18: warning: ISO C++1z does not allow 'register' storage class specifier [-Wregister]
   register void *pc = NULL;
                  ^~
/usr/src/app/src/symbolize_unittest.cc: In function 'void* non_inline_func()':
/usr/src/app/src/symbolize_unittest.cc:323:18: warning: ISO C++1z does not allow 'register' storage class specifier [-Wregister]
   register void *pc = NULL;
                  ^~
In file included from /usr/src/app/src/logging_unittest.cc:58:0:
/usr/src/app/src/googletest.h:581:33: error: ISO C++1z does not allow dynamic exception specifications
 void* operator new(size_t size) throw�[m(std::bad_alloc) {
                                 ^~~~~
/usr/src/app/src/googletest.h:588:35: error: ISO C++1z does not allow dynamic exception specifications
 void* operator new[](size_t size) throw(std::bad_alloc) {
                                   ^~~~~
CMakeFiles/symbolize_unittest.dir/build.make:62: recipe for target 'CMakeFiles/symbolize_unittest.dir/src/symbolize_unittest.cc.o' failed
make[2]: *** [CMakeFiles/symbolize_unittest.dir/src/symbolize_unittest.cc.o] Error 1
CMakeFiles/Makefile2:1185: recipe for target 'CMakeFiles/symbolize_unittest.dir/all' failed
make[1]: *** [CMakeFiles/symbolize_unittest.dir/all] Error 2
/usr/src/app/src/logging_unittest.cc: In function 'void TestDCHECK()':
/usr/src/app/src/logging_unittest.cc:575:3: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
   auto_ptr<int64> sptr(new int64);
   ^~~~~~~~
In file included from /usr/include/c++/7/bits/locale_conv.h:41:0,
                 from /usr/include/c++/7/locale:43,
                 from /usr/include/c++/7/iomanip:43,
                 from /usr/src/app/src/logging_unittest.cc:44:
/usr/include/c++/7/bits/unique_ptr.h:51:28: note: declared here
   template<typename> class auto_ptr;
                            ^~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions