From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 918EB3858C51 for ; Fri, 1 Jul 2022 20:30:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 918EB3858C51 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-304-mt1zKrXPPk6iNJcReRp4QA-1; Fri, 01 Jul 2022 16:30:47 -0400 X-MC-Unique: mt1zKrXPPk6iNJcReRp4QA-1 Received: by mail-ed1-f71.google.com with SMTP id z19-20020a05640240d300b00437633081abso2452727edb.0 for ; Fri, 01 Jul 2022 13:30:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=9Ph7vOQKIXGiQGTVZ5H/fs1zgl8bjDoMzfvdO1O/+9E=; b=J0SS8AobMPZDtgt9VovwnU7KsQB68e+u9btcEI8+oitjYpmvQJNlnQb0kx/wO+iYzJ XunigvnlLF/Sdk4d+dTT1xFFr9ZVe0aPmA/t41lSXosVarmBK7Db78OGVU761DVJWXUl JIYcJKYqtZhu084w6JYA/M9KO4FE/0qGF7iSvldG+LYPkySFiFU/POx8GS14gNAB9cPP v+t0v3dOhIlrl5G9YxszsPmNXx+AkKQXfsGMCc1wh/NLGeR4hH66sdr3bOuOlSGyLugc O2XVNlFFG71BcipcwS1fzC7ZxnxaAp1QrHkKy7GM7b+DOFc+W4ZkSUIWvL1bfXWfBHu9 tH/w== X-Gm-Message-State: AJIora8lNNWQMsZe8Wdd5xOeMc7b6C5NCtIOu+q09vc6aZFVbw8jwry+ FBzQAhiBEwtY6TKIKnJqappAPmM3B0khF8kQsaaOfEdqEG0UTgwCzh4XqVa2JeSmluxDcQfJFVg 7ZQ8JImYXnsN4qGX8cA== X-Received: by 2002:a17:907:7295:b0:726:e4fa:1c93 with SMTP id dt21-20020a170907729500b00726e4fa1c93mr15658429ejc.739.1656707445539; Fri, 01 Jul 2022 13:30:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uCgPkJoKkp/v/Zyg11LaW23aSpo/ETtQpAGiDfhM3D6qIlA2AEOS8ntoeEcgGvjrKsVYOGAw== X-Received: by 2002:a17:907:7295:b0:726:e4fa:1c93 with SMTP id dt21-20020a170907729500b00726e4fa1c93mr15658413ejc.739.1656707445291; Fri, 01 Jul 2022 13:30:45 -0700 (PDT) Received: from [192.168.178.55] (73-5-133-N4.customer.vsm.sh. [170.133.5.73]) by smtp.gmail.com with ESMTPSA id n18-20020a05640204d200b00435a08a3557sm15672395edw.27.2022.07.01.13.30.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Jul 2022 13:30:44 -0700 (PDT) Message-ID: <90daa422-016f-4dc7-a422-3fb9ae5e90fd@redhat.com> Date: Fri, 1 Jul 2022 22:30:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [pushed] c++: Include -Woverloaded-virtual in -Wall [PR87729] To: Jason Merrill , gcc-patches@gcc.gnu.org References: <20220624222604.335563-1-jason@redhat.com> From: Stephan Bergmann In-Reply-To: <20220624222604.335563-1-jason@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2022 20:30:50 -0000 On 6/25/22 00:26, Jason Merrill via Gcc-patches wrote: > 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. This now causes > $ 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(); }; > | ^