[cfe-dev] [Warnings] final class with virtual functions

Piotr Padlewski via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 21 17:24:26 PST 2016


Hi,
I was wondering if we should warn about cases like this:

*struct* A final {

   *virtual* *int* foo () {*return* 42;}

   // virtual doesn't make any sense because it is final base class

};


or


*struct* A {

  *virtual* *int* foo () final {*return* 42;}

  // the same thing

};


So in both cases it sounds like a bug, specially in the first case.

I don't see any resonable cases where this code would make sense (what you
could not achieve with override keyword).


If emiting warning in these cases make sense, dibs on that feature.


Piotr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161222/16c54ee2/attachment.html>


More information about the cfe-dev mailing list