<div dir="auto"><div data-smartmail="gmail_signature" dir="auto">On 22 Dec 2016 2:33 p.m., "Aaron Ballman via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Wed, Dec 21, 2016 at 8:24 PM, Piotr Padlewski<br>
<<a href="mailto:piotr.padlewski@gmail.com">piotr.padlewski@gmail.com</a>> wrote:<br>
> Hi,<br>
> I was wondering if we should warn about cases like this:<br>
><br>
> struct A final {<br>
><br>
>    virtual int foo () {return 42;}<br>
><br>
>    // virtual doesn't make any sense because it is final base class<br>
><br>
> };<br>
><br>
><br>
> or<br>
><br>
><br>
> struct A {<br>
><br>
>   virtual int foo () final {return 42;}<br>
><br>
>   // the same thing<br>
><br>
> };<br>
><br>
><br>
> So in both cases it sounds like a bug, specially in the first case.<br>
<br>
</div>I don't think it sounds like a bug (at least, nothing we'd want to<br>
diagnose in the frontend).<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I think it's a bug, but I also think it's unlikely to happen.</div><div dir="auto"><br></div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Prior to the override keyword, some coding style guidelines<br>
recommended you write virtual on all virtual functions (instead of<br>
just the first declaration of such a function in a base class) to make<br>
it clear that the function is one that can be overridden.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">The warning is about declaring a virtual method that cannot be overridden. </div><div dir="auto">It wouldn't trigger for methods that are overriding, whether the override keyword is used it not.</div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div><br></div><div class="gmail_extra" dir="auto"><span style="font-family:sans-serif">-- </span><br style="font-family:sans-serif"><span style="font-family:sans-serif">Malcolm Parsons</span><br></div></div>