From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89967 invoked by alias); 12 Dec 2018 15:30:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 86590 invoked by uid 89); 12 Dec 2018 15:30:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=painful, blast, U*jason, jasonredhatcom X-HELO: mail-oi1-f176.google.com Received: from mail-oi1-f176.google.com (HELO mail-oi1-f176.google.com) (209.85.167.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Dec 2018 15:30:23 +0000 Received: by mail-oi1-f176.google.com with SMTP id x202so15298059oif.13 for ; Wed, 12 Dec 2018 07:30:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oZpSdE+iJZU3l1ViX35PmHtYY9tmJeVxdralfUjnaGY=; b=FHuxJJ9pTS15Y9AOpjODVJmXbHLbGQrFxRxN5EWxwwwlT/fzqS3mHs5YiYIb8hWzRs X9Z8gW4za7S+NRreeguRMhE8lzys++snnvK2S4wLVfbsos2Ho8Oqds/UeBBPB2LdMljY p006TcZBpnnEIqQ+dxB/GxJqft9VqmQ9I6j55HLoZmXWg/T3GBnhEE830PFeFGv8oFQQ ruqNlwESFfG2zRz/8Xw8C7Zi0RgqmowNxPTXqojLb+mv3FhHGixwfHJiwgLj+MbObMMO SP/MznghqMOV5CE3GUUV40MIxYoTLIJJ7pH35A4ZX42ZbyFr2jtrHXG1UtHwbipjZZaW BBCQ== MIME-Version: 1.0 References: <20181208165817.GU12380@tucnak> In-Reply-To: From: Ville Voutilainen Date: Wed, 12 Dec 2018 15:30:00 -0000 Message-ID: Subject: Re: C++ PATCH for c++/88136, -Wdeprecated-copy too noisy To: Jason Merrill Cc: Jakub Jelinek , gcc-patches List Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2018-12/txt/msg00824.txt.bz2 On Wed, 12 Dec 2018 at 16:52, Jason Merrill 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.)