diff options
author | Jonathan Wakely <jwakely.gcc@gmail.com> | 2011-06-04 16:18:36 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2011-06-04 17:18:36 +0100 |
commit | 014ab419efc12a59efebd2720d79e1c055675c85 (patch) | |
tree | 4ce2195c12b8ddb26d94b2802f6dbe2017ee0eee /gcc/doc | |
parent | f90d37ec0c1fbac6a987b546167ba9a26d399c5f (diff) | |
download | gcc-014ab419efc12a59efebd2720d79e1c055675c85.zip gcc-014ab419efc12a59efebd2720d79e1c055675c85.tar.gz gcc-014ab419efc12a59efebd2720d79e1c055675c85.tar.bz2 |
invoke.texi: Document -Wdelete-non-virtual-dtor.
* doc/invoke.texi: Document -Wdelete-non-virtual-dtor.
c-family:
* c.opt: Add -Wdelete-non-virtual-dtor.
* c-opts.c (c_common_handle_option): Include it in -Wall.
cp:
* init.c (build_delete): Warn when deleting type with non-virtual
destructor.
testsuite:
* testsuite/g++.dg/warn/delete-non-virtual-dtor.C: New.
From-SVN: r174643
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 585901e..a069042 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2331,6 +2331,15 @@ Warn when a class seems unusable because all the constructors or destructors in that class are private, and it has neither friends nor public static member functions. +@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)} +@opindex Wdelete-non-virtual-dtor +@opindex Wno-delete-non-virtual-dtor +Warn when @samp{delete} is used to destroy an instance of a class which +has virtual functions and non-virtual destructor. It is unsafe to delete +an instance of a derived class through a pointer to a base class if the +base class does not have a virtual destructor. This warning is enabled +by @option{-Wall}. + @item -Wnoexcept @r{(C++ and Objective-C++ only)} @opindex Wnoexcept @opindex Wno-noexcept |