From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46439 invoked by alias); 8 Dec 2018 17:53:42 -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 46413 invoked by uid 89); 8 Dec 2018 17:53:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=macros, Hx-languages-length:2006, concerns, occasionally X-HELO: mail-ot1-f45.google.com Received: from mail-ot1-f45.google.com (HELO mail-ot1-f45.google.com) (209.85.210.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 08 Dec 2018 17:53:40 +0000 Received: by mail-ot1-f45.google.com with SMTP id 32so6750947ota.12 for ; Sat, 08 Dec 2018 09:53:40 -0800 (PST) MIME-Version: 1.0 References: <20181208165817.GU12380@tucnak> In-Reply-To: From: Jason Merrill Date: Sat, 08 Dec 2018 17:53:00 -0000 Message-ID: Subject: Re: C++ PATCH for c++/88136, -Wdeprecated-copy too noisy To: Ville Voutilainen Cc: Jakub Jelinek , gcc-patches List Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00520.txt.bz2 On Sat, Dec 8, 2018 at 12:17 PM Ville Voutilainen wrote: > On Sat, 8 Dec 2018 at 18:58, Jakub Jelinek wrote: > > > g++ -c -pipe -O2 -fPIC -std=c++1z -fvisibility=hidden > > > -fvisibility-inlines-hidden -ffunction-sections -fdata-sections > > > -fno-exceptions -Wall -W -Wvla -Wdate-time -Wshift-overflow=2 > > > > -W is an alias to -Wextra. > > Yeah. Jason, I seem to have code that user-provides a copy constructor (seemingly for no particular reason), > doesn't bother declaring a copy assignment operator, and still breaks magnificently. :) There is no bug > in it; the assignment works as expected, so that's a false positive. I am going to suggest taking this warning > out of -Wextra and making it completely separate for GCC 9. The documented policy for -Wall is, This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros. ... Note that some warning flags are not implied by '-Wall'. Some of them warn about constructions that users generally do not consider questionable, but which occasionally you might wish to check for; others warn about constructions that are necessary or hard to avoid in some cases, and there is no simple way to modify the code to suppress the warning. It seems to me that this warning qualifies for -Wall under these guidelines. Providing a copy constructor without a matching assignment operator is definitely suspect; the false positive only comes in because, as you say, there was no good reason to provide the copy constructor for Private. And it's easy to avoid the warning by declaring a defaulted assignment operator, if ABI concerns preclude removing the constructor. New compiler releases will usually include new warnings that require some code modification to accommodate. Why is this one particularly problematic? Jason