* Ulrich Drepper via Gcc:
> I found myself with code similar to this:
>
> struct base {
> virtual void cb() = 0;
> };
>
> struct deriv final : public base {
> void cb() final override { }
> };
>
>
> The question is about the second use of 'final'. Because the entire
> class is declared final, should the individual function's annotation be
> flagged with a warning? I personally think it should because it might
> distract from the final of the class itself.
It is not always redundant. This is not expected to compile:
struct base {
void cb();
};
struct deriv final : public base {
void cb() final { }
};
I don't know why the standard requires this check for a virtual function
definition. Knowing that would help to decide whether the new warning
makes sense.
Thanks,
Florian
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill