public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ville Voutilainen <ville.voutilainen@gmail.com>
To: Jason Merrill <jason@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: C++ PATCH for c++/88136, -Wdeprecated-copy too noisy
Date: Wed, 12 Dec 2018 15:30:00 -0000	[thread overview]
Message-ID: <CAFk2RUZ4YfK8B2j-kFzTWOErko3r_XyNbtQxCr7xzBJG3wUPcg@mail.gmail.com> (raw)
In-Reply-To: <CADzB+2nDxLdvG_Ybug33nZNiJu2i9cLLaD5Eh0nhZJMBJhJQDA@mail.gmail.com>

On Wed, 12 Dec 2018 at 16:52, Jason Merrill <jason@redhat.com> wrote:

> > For what it's worth, I find it unfortunate that this deprecation and its resulting warnings end up
> > making the decision on whether a "rule of 5" must be followed; correct code needs to be adjusted
> > to cope with a fairly stylistic matter, with false positives and all.
>
> I don't see it as a stylistic matter.  If you need a user-provided
> copy constructor to get proper copy semantics for a class, you almost
> certainly need the same thing for copy assignment.  This was too noisy
> for destructors, for which it's fairly common to define a virtual
> destructor just to make a class polymorphic, not because there are
> significant destruction semantics.  But I don't see a similar argument
> for copy constructors: in your example, there was no need for
> QVariant::Private to define a copy constructor, and that seems like a
> situation where a warning is reasonable, even if the code is in fact
> correct.

I have other cases where the compiler warns besides QVariant::Private.
I don't have a good grasp of what
those cases are like, yet, because I'll look at those warnings some
time later, possibly next year. :)
Thus I don't have any idea whether there are practical cases where the
copy constructor allocates but the assignment
can just blast bits, although I find that rather plausible. (Side
note: disabling warnings in Qt is painful; it's
not really more or less painful than doing code changes and regtesting
those on all platforms; that's not your
problem, though.)

      reply	other threads:[~2018-12-12 15:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06 21:12 Jason Merrill
2018-12-08 16:46 ` Ville Voutilainen
2018-12-08 16:58   ` Jakub Jelinek
2018-12-08 17:17     ` Ville Voutilainen
2018-12-08 17:53       ` Jason Merrill
2018-12-08 18:05         ` Ville Voutilainen
2018-12-08 18:33           ` Ville Voutilainen
2018-12-12 14:52             ` Jason Merrill
2018-12-12 15:30               ` Ville Voutilainen [this message]

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=CAFk2RUZ4YfK8B2j-kFzTWOErko3r_XyNbtQxCr7xzBJG3wUPcg@mail.gmail.com \
    --to=ville.voutilainen@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    /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).