This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/67036] GCC does not warn of throwing destructors in C++11, even when they lack noexcept(false) and std::uncaught_exception


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?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]