This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67036] GCC does not warn of throwing destructors in C++11, even when they lack noexcept(false) and std::uncaught_exception
- From: "egallager at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 28 Sep 2017 12:16:28 +0000
- Subject: [Bug c++/67036] GCC does not warn of throwing destructors in C++11, even when they lack noexcept(false) and std::uncaught_exception
- Auto-submitted: auto-generated
- References: <bug-67036-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67036
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
I get a warning from -Wterminate with current gcc:
$ /usr/local/bin/g++ -O1 -Wall -Wextra -c -pedantic 67036.cc
67036.cc: In destructor ‘useless::~useless()’:
67036.cc:7:90: warning: throw will always call terminate() [-Wterminate]
~useless() { std::cout << "out" << std::endl; throw
std::runtime_error("who knows..."); }
^
67036.cc:7:90: note: in C++11 destructors default to noexcept
67036.cc: In function ‘int main(int, char**)’:
67036.cc:10:31: warning: unused parameter ‘argv’ [-Wunused-parameter]
int main(int argc, char* argv[])
^
$
Is this what you were looking for?