public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
@ 2020-08-07 14:48 ` xantares09 at hotmail dot com
  2020-08-07 14:49 ` xantares09 at hotmail dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: xantares09 at hotmail dot com @ 2020-08-07 14:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

xantares09 at hotmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xantares09 at hotmail dot com

--- Comment #4 from xantares09 at hotmail dot com ---
Created attachment 49021
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49021&action=edit
enable -Woverloaded-virtual by -Wall

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
  2020-08-07 14:48 ` [Bug c++/87729] Please include -Woverloaded-virtual in -Wall xantares09 at hotmail dot com
@ 2020-08-07 14:49 ` xantares09 at hotmail dot com
  2020-09-21  0:04 ` egallager at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: xantares09 at hotmail dot com @ 2020-08-07 14:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

--- Comment #5 from xantares09 at hotmail dot com ---
still there with 10.1, see attached patch

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
  2020-08-07 14:48 ` [Bug c++/87729] Please include -Woverloaded-virtual in -Wall xantares09 at hotmail dot com
  2020-08-07 14:49 ` xantares09 at hotmail dot com
@ 2020-09-21  0:04 ` egallager at gcc dot gnu.org
  2022-06-24 19:34 ` jason at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: egallager at gcc dot gnu.org @ 2020-09-21  0:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to xantares09 from comment #5)
> still there with 10.1, see attached patch

Please submit your patch to the gcc-patches mailing list for review

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-09-21  0:04 ` egallager at gcc dot gnu.org
@ 2022-06-24 19:34 ` jason at gcc dot gnu.org
  2022-06-24 21:29 ` dblaikie at gmail dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2022-06-24 19:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
   Target Milestone|---                         |13.0
                 CC|                            |jason at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-06-24 19:34 ` jason at gcc dot gnu.org
@ 2022-06-24 21:29 ` dblaikie at gmail dot com
  2022-06-24 22:26 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: dblaikie at gmail dot com @ 2022-06-24 21:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

David Blaikie <dblaikie at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dblaikie at gmail dot com

--- Comment #7 from David Blaikie <dblaikie at gmail dot com> ---
FWIW, I implemented (or at least tuned) overloaded-virtual in Clang - it
doesn't quite match GCC's behavior. (specifically it doesn't warn on two
overloads within the same class - it specifically warns on the case where a
user might've mismatched what was intended to be an override but instead became
an overload).

At least that's my recollection.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-06-24 21:29 ` dblaikie at gmail dot com
@ 2022-06-24 22:26 ` cvs-commit at gcc dot gnu.org
  2022-06-24 22:28 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-24 22:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:113844d68e94f4e9c0e946db351ba7d3d4a1335a

commit r13-1262-g113844d68e94f4e9c0e946db351ba7d3d4a1335a
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jun 24 14:40:12 2022 -0400

    c++: Include -Woverloaded-virtual in -Wall [PR87729]

    This seems like a good warning to have in -Wall, as requested.  But as
    pointed out in PR20423, some users want a warning only when a derived
    function doesn't override any base function.  So let's put that lesser
    version in -Wall (and -Woverloaded-virtual=1) while leaving the semantics
    for the existing option the same.

            PR c++/87729
            PR c++/20423

    gcc/c-family/ChangeLog:

            * c.opt (Woverloaded-virtual): Add levels, include in -Wall.

    gcc/ChangeLog:

            * doc/invoke.texi: Document changes.

    gcc/cp/ChangeLog:

            * class.cc (warn_hidden): Handle -Woverloaded-virtual=1.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Woverloaded-virt1.C: New test.
            * g++.dg/warn/Woverloaded-virt2.C: New test.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2022-06-24 22:26 ` cvs-commit at gcc dot gnu.org
@ 2022-06-24 22:28 ` jason at gcc dot gnu.org
  2022-07-05  8:17 ` sbergman at redhat dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2022-06-24 22:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Done for GCC 13.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2022-06-24 22:28 ` jason at gcc dot gnu.org
@ 2022-07-05  8:17 ` sbergman at redhat dot com
  2022-07-07 16:00 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: sbergman at redhat dot com @ 2022-07-05  8:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

Stephan Bergmann <sbergman at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sbergman at redhat dot com

--- Comment #10 from Stephan Bergmann <sbergman at redhat dot com> ---
(In reply to CVS Commits from comment #8)
> The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:113844d68e94f4e9c0e946db351ba7d3d4a1335a
> 
> commit r13-1262-g113844d68e94f4e9c0e946db351ba7d3d4a1335a
> Author: Jason Merrill <jason@redhat.com>
> Date:   Fri Jun 24 14:40:12 2022 -0400
> 
>     c++: Include -Woverloaded-virtual in -Wall [PR87729]

This started to cause spurious -Woverloaded-virtual= warnings now (first
reported at <https://gcc.gnu.org/pipermail/gcc-patches/2022-July/597670.html>
"Re: [pushed] c++: Include -Woverloaded-virtual in -Wall [PR87729]"):

> $ cat test.cc
> struct S1 {};
> struct S2: S1 { virtual ~S2(); };
> struct S3 { virtual ~S3(); };
> struct S4: S2, S3 { virtual ~S4(); };

> $ g++ -Woverloaded-virtual -fsyntax-only test.cc
> test.cc:3:21: warning: ‘virtual S3::~S3()’ was hidden [-Woverloaded-virtual=]
>     3 | struct S3 { virtual ~S3(); };
>       |                     ^
> test.cc:4:29: note:   by ‘virtual S4::~S4()’
>     4 | struct S4: S2, S3 { virtual ~S4(); };
>       |                             ^
> test.cc:3:21: warning: ‘virtual S3::~S3()’ was hidden [-Woverloaded-virtual=]
>     3 | struct S3 { virtual ~S3(); };
>       |                     ^
> test.cc:4:29: note:   by ‘virtual S4::~S4()’
>     4 | struct S4: S2, S3 { virtual ~S4(); };
>       |                             ^
> test.cc:3:21: warning: ‘virtual S3::~S3()’ was hidden [-Woverloaded-virtual=]
>     3 | struct S3 { virtual ~S3(); };
>       |                     ^
> test.cc:4:29: note:   by ‘virtual S4::~S4()’
>     4 | struct S4: S2, S3 { virtual ~S4(); };
>       |                             ^

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2022-07-05  8:17 ` sbergman at redhat dot com
@ 2022-07-07 16:00 ` cvs-commit at gcc dot gnu.org
  2022-07-08  6:11 ` sbergman at redhat dot com
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-07 16:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:81bec060e31b6ef2feeb3046c6f13a207c6f698a

commit r13-1559-g81bec060e31b6ef2feeb3046c6f13a207c6f698a
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jul 7 10:12:04 2022 -0400

    c++: -Woverloaded-virtual and dtors [PR87729]

    My earlier patch broke out of the loop over base members when we found a
    match, but that caused trouble for dtors, which can have multiple for which
    same_signature_p is true.  But as the function comment says, we know this
    doesn't apply to [cd]tors, so skip them.

            PR c++/87729

    gcc/cp/ChangeLog:

            * class.cc (warn_hidden): Ignore [cd]tors.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Woverloaded-virt3.C: New test.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2022-07-07 16:00 ` cvs-commit at gcc dot gnu.org
@ 2022-07-08  6:11 ` sbergman at redhat dot com
  2022-07-25 13:23 ` cvs-commit at gcc dot gnu.org
  2022-07-25 13:24 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: sbergman at redhat dot com @ 2022-07-08  6:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

--- Comment #12 from Stephan Bergmann <sbergman at redhat dot com> ---
(In reply to CVS Commits from comment #11)
> The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:81bec060e31b6ef2feeb3046c6f13a207c6f698a
> 
> commit r13-1559-g81bec060e31b6ef2feeb3046c6f13a207c6f698a
> Author: Jason Merrill <jason@redhat.com>
> Date:   Thu Jul 7 10:12:04 2022 -0400
> 
>     c++: -Woverloaded-virtual and dtors [PR87729]

This still starts to produces spurious warnings for diamond inheritance:

> $ cat test.cc
> struct S1 { virtual void f(); };
> struct S2: S1 {};
> struct S3: S1 {};
> struct S4: S2, S3 { void f(); };

> $ g++ -Woverloaded-virtual -fsyntax-only test.cc
> test.cc:1:26: warning: ‘virtual void S1::f()’ was hidden [-Woverloaded-virtual=]
>     1 | struct S1 { virtual void f(); };
>       |                          ^
> test.cc:4:26: note:   by ‘virtual void S4::f()’
>     4 | struct S4: S2, S3 { void f(); };
>       |                          ^

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2022-07-08  6:11 ` sbergman at redhat dot com
@ 2022-07-25 13:23 ` cvs-commit at gcc dot gnu.org
  2022-07-25 13:24 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-25 13:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:4c6567b4090d9363f90b5c68e238e7d0964b6e89

commit r13-1824-g4c6567b4090d9363f90b5c68e238e7d0964b6e89
Author: Jason Merrill <jason@redhat.com>
Date:   Sun Jul 24 23:26:59 2022 -0400

    c++: -Woverloaded-virtual false positive [PR87729]

    My attempt to shortcut unnecessary checking after finding a match was
    also wrong for multiple inheritance, so let's give up on it.

            PR c++/87729

    gcc/cp/ChangeLog:

            * class.cc (warn_hidden): Remove shortcut.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Woverloaded-virt4.C: New test.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/87729] Please include -Woverloaded-virtual in -Wall
       [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2022-07-25 13:23 ` cvs-commit at gcc dot gnu.org
@ 2022-07-25 13:24 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2022-07-25 13:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729

--- Comment #14 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Stephan Bergmann from comment #12)
> This still starts to produces spurious warnings for diamond inheritance:

Fixed, thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-07-25 13:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-87729-4@http.gcc.gnu.org/bugzilla/>
2020-08-07 14:48 ` [Bug c++/87729] Please include -Woverloaded-virtual in -Wall xantares09 at hotmail dot com
2020-08-07 14:49 ` xantares09 at hotmail dot com
2020-09-21  0:04 ` egallager at gcc dot gnu.org
2022-06-24 19:34 ` jason at gcc dot gnu.org
2022-06-24 21:29 ` dblaikie at gmail dot com
2022-06-24 22:26 ` cvs-commit at gcc dot gnu.org
2022-06-24 22:28 ` jason at gcc dot gnu.org
2022-07-05  8:17 ` sbergman at redhat dot com
2022-07-07 16:00 ` cvs-commit at gcc dot gnu.org
2022-07-08  6:11 ` sbergman at redhat dot com
2022-07-25 13:23 ` cvs-commit at gcc dot gnu.org
2022-07-25 13:24 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).