This is the mail archive of the gcc-patches@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]

Re: [C++] Weffc++/Wnon-virtual-dtor confusion


On 2014.04.04 at 17:48 +0100, Nathan Sidwell wrote:
> On 04/04/14 17:38, Markus Trippelsdorf wrote:
> 
> > I'm not sure that this is a good idea. This changes the existing
> > behavior of -Wnon-virtual-dtor and causes hundreds of new warnings when
> > building LLVM. Wouldn't it make more sense to move the 3rd ed Weffc++
> > behavior to the -Weffc++ flag alone?
> 
> IIUC you're using -Wnon-virtual-dtor on its own, is that right?  What are the 
> class shapes where you're seeing this behaviour?
> 
> AFAICT the -Wnon-virtual-dtor warning was an attempt to separate out that 
> particular -Weffc++ warning, but it was broken.

For example:

markus@x4 tmp % cat test.ii
class Option
{
public:
  virtual ~Option ();
};
template <int> class opt_storage
{
};
template <int = 0> class A : Option, opt_storage<0>
{
};
template class A<>;

markus@x4 tmp % g++ -Wnon-virtual-dtor -std=c++11 -c test.ii
test.ii: In instantiation of âclass A<>â:
test.ii:12:16:   required from here
test.ii:9:26: warning: base class âclass opt_storage<0>â has accessible non-virtual destructor [-Wnon-virtual-dtor]
 template <int = 0> class A : Option, opt_storage<0>
                          ^
markus@x4 tmp % clang++ -Wnon-virtual-dtor -std=c++11 -c test.ii
markus@x4 tmp %
(Before your commit)
markus@x4 tmp % g++ -Wnon-virtual-dtor -std=c++11 -c test.ii
markus@x4 tmp %  

-- 
Markus


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