[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2016-10-17 Thread a.volkov at rusbitech dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

--- Comment #13 from Alexander Volkov  ---
There was no response, so I created a new bugreport:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010

[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2016-10-13 Thread a.volkov at rusbitech dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

--- Comment #12 from Alexander Volkov  ---
Sorry, it should be
struct B : A {
  virtual void f() final;
};
in the first example.

[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2016-10-13 Thread a.volkov at rusbitech dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

Alexander Volkov  changed:

   What|Removed |Added

 CC||a.volkov at rusbitech dot ru

--- Comment #11 from Alexander Volkov  ---
Please, reopen.

Of course, it makes sense to suggest adding override in the following case:
struct A {
  virtual void f();
};
struct B : A {
  virtual void f() final override;
};

B::f() is specified as virtual, so if we remove A::f(), then B::f() will not
become a new virtual, but we'll get a compile error instead thanks to
'override' keyword.

But it is redundant in the following case:
struct A {
  virtual void f();
};
struct B : A {
  void f() final;
};

It is absolutely clear that B::f() overrides A::f(). If we remove A::f() or
change it's signature, then we'll get an error. There is no need to add
'override' here.

[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2016-08-11 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|CLOSED  |RESOLVED
 Resolution|FIXED   |INVALID

[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2016-08-11 Thread thomas.helfer at cea dot fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

Helfer Thomas  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED
 Resolution|INVALID |FIXED

--- Comment #10 from Helfer Thomas  ---
Close ticket

[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2016-08-11 Thread ol.rakhimov at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

ol.rakhimov at gmail dot com changed:

   What|Removed |Added

 CC||ol.rakhimov at gmail dot com

--- Comment #9 from ol.rakhimov at gmail dot com ---
Please reconsider this bug to get fixed.
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-override

Clang doesn't throw warnings for using single ``final`` with
inconsistent-override warnings.

[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2015-04-23 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

--- Comment #8 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
(In reply to Helfer Thomas from comment #7)
 can you give me the rationale of this usage ?

Performance. 
See also -Wsuggest-final-types -Wsuggest-final-methods in the gcc manual.

Although Stroustrup recommends to not use final blindly, without prior
measurements (20.3.4.2., TC++PL 4th edition).


[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2015-04-23 Thread thomas.helfer at cea dot fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

--- Comment #7 from Helfer Thomas thomas.helfer at cea dot fr ---
can you give me the rationale of this usage ?


[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2015-04-23 Thread thomas.helfer at cea dot fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

Helfer Thomas thomas.helfer at cea dot fr changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #5 from Helfer Thomas thomas.helfer at cea dot fr ---
I must say that your example seems very artificial : to me, the only case where
final specifier may not imply the override one is when you create a virtual
method and immediately declare it final : in this case what is the meaning of
declaring the method virtual ? 

I can't find any good reason for this but I admit that, as this is allowed by
the standard, my enhancement proposition can't be accepted. So I am closing the
report.

Thank you for your reply.

Sincerly,

Helfer Thomas


[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2015-04-23 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

--- Comment #6 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
If you want some real life examples, grep e.g. the Firefox source tree
for final override or override final.


[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2015-04-23 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek mpolacek at gcc dot gnu.org ---
I think the following may be used as a test case.

struct A
{
  virtual void f ();
};

struct B : A
{
  virtual void f () final;
};


[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2015-04-23 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

--- Comment #4 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
I forgot to add with -Wall -Wextra. gcc needs explicit -Woverloaded-virtual.


[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2015-04-23 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

--- Comment #3 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
And BTW both clang and EDG warn for the first example:

foo.cpp:6:16: warning: 'B::f' hides overloaded virtual function
[-Woverloaded-virtual]
  virtual void f() final;
   ^
foo.cpp:2:16: note: hidden overloaded virtual function 'A::f' declared here:
different number of parameters (1 vs 0)
  virtual void f(int);
   ^
1 warning generated.

foo.cpp(6): warning #1125: function A::f(int) is hidden by B::f -- virtual
function override intended?
virtual void f() final;
 ^


[Bug c++/65856] -Wsuggest-override shall not report a warning on final method

2015-04-23 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65856

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 CC||trippels at gcc dot gnu.org

--- Comment #2 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
I think override and final are orthogonal. And it might make sense to use both.
e.g.:
struct A {
  virtual void f(int);
};
struct B : A {
  virtual void f() final;
};

is valid.

But:
struct A {
  virtual void f(int);
};
struct B : A {
  virtual void f() final override;
};

would of course error out.