in C++11 destructors default to noexcept
compiling with gcc 6.1 give the warning in the subject since qslog destructor catch an exception
Comments (5)
-
repo owner -
g++ -c -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -Wall
qslog/QsLog.cpp: In destructor ‘QsLogging::Logger::Helper::~Helper()’: qslog/QsLog.cpp:223:9: warning: throw will always call terminate() [-Wterminate] throw; ^~~~~ qslog/QsLog.cpp:223:9: note: in C++11 destructors default to noexcept
gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc-multilib/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release Thread model: posix gcc version 6.1.1 20160501 (GCC)
please try a distro that already ship gcc 6.1.1, I'm on archlinux
additional info here:
-
repo owner Thanks for the details. I think I will modernize the code base to take advantage of C++11 and also remove the try catch inside this destructor.
-
repo owner Update: I have an initial C++11 commit and I just enabled CI on the repo. I should publish it latest by the end of next week.
-
repo owner - changed status to resolved
Fixed in latest master.
- Log in to comment
The destructor catches the exception for debugging purposes and rethrows it, a sink is not supposed to throw exceptions. Which is the warning option triggering this?