public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "emerg.reanimator at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/109740] -Woverloaded-virtual is too aggressive
Date: Wed, 01 Nov 2023 18:04:39 +0000	[thread overview]
Message-ID: <bug-109740-4-61fZVJklGY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109740-4@http.gcc.gnu.org/bugzilla/>

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

Alexander Goomenuk <emerg.reanimator at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |emerg.reanimator at gmail dot com

--- Comment #3 from Alexander Goomenuk <emerg.reanimator at gmail dot com> ---
Let consider the following case:
- There is a base class that implement virtual assignment operator with
arbitrary input argument (not copy operator).
- There is a derived class that inherits the assignment operator from base
class.

g++ version >= 13 produces the warning in this case because implicitly-defined
copy operator of derived class pretends to hide the user defined assignment
operator of base class. The code is totally fine and the assignment operator
works as expected. 

Even worse, the warning is produced by compiler even if no implicitly-defined
copy operator is NOT generated by the compiler and the code fails to build due
to the lack of copy operator. So the warning is misleading and incorrect in
this case.

See
https://stackoverflow.com/questions/77378553/woverloaded-virtual-with-default-shallow-copy-operator
for more details.

  parent reply	other threads:[~2023-11-01 18:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04 16:40 [Bug c++/109740] New: " psmith at gnu dot org
2023-05-04 16:46 ` [Bug c++/109740] " pinskia at gcc dot gnu.org
2023-05-04 17:45 ` psmith at gnu dot org
2023-11-01 18:04 ` emerg.reanimator at gmail dot com [this message]
2023-11-01 18:56 ` emerg.reanimator at gmail dot com
2023-11-02 20:52 ` emerg.reanimator at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109740-4-61fZVJklGY@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).