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 1FA60385AC3B for ; Tue, 25 Oct 2022 15:24:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1FA60385AC3B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666711473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=b5TzV/hKmYrh+Imu6pPiFUw9Jfrpq+5dUCzrey1wldQ=; b=B8MxB9vphwWzetUCWiFmb9Z2d+e+GMwJAgTT9f0XCoOzAN3BvbhxW1g7C4BJU8sJa+X+m4 sS8tJI+SC8w7mrM7jp+NbGDZ11juUwbAPrv0zS17PQyOOSnYtAJ+yEwPKGJ3Xdwum9wFZp bRm6Fw7XGpfM5Om+kMKL/6axHT27D2M= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-624-kUgXN-hkNH64Kq9BLHT-qQ-1; Tue, 25 Oct 2022 11:24:31 -0400 X-MC-Unique: kUgXN-hkNH64Kq9BLHT-qQ-1 Received: by mail-qt1-f197.google.com with SMTP id ga23-20020a05622a591700b0039ceee61202so9163333qtb.2 for ; Tue, 25 Oct 2022 08:24:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b5TzV/hKmYrh+Imu6pPiFUw9Jfrpq+5dUCzrey1wldQ=; b=7t7gmZCaX2x9Esd9Jet2DWyvU/UuTqgQ8E0YLkY0FbjiU47SWlW1SMjWqHrJ1o+N5M /Z0ECe/niuznemKNjvUCjZvlMHQzqNn0JdfMT/ej3CXiFkJ67sl8TLUgAKrXJtjtrgJc h3maoJ0oSTwo6tMn6Wd/N+cg6nBCD3C5sKTKCobn9v/aPARy6eLjV9Xx7zDswLbP81Ez 7JPq6Dv3L9oomSprSECTZVytYuy6n//yeuf+WtQab/IJ1pI5pSGeoSKA2cVuAACPFuiX obWIHOIW5rNs2c/rHYFGgj2vzCr0ER82v7VzMj81mxWdXZtwKbPXTzoBHIuuxZcsI+CJ zjBg== X-Gm-Message-State: ACrzQf2nR09kQ7sbzWk3xbNAIL5aXm4Fp+vEwnP9xz/5sqjnwlzRUKWy Uk701z6wZVgKTTcCE6Qz60bdVUIcBH8UM9va72ehv+c6WLUd57jssCqw/bj8eAuFs7gRCbAn3cG 8PM0NdGS0G42DghsQqg== X-Received: by 2002:a05:622a:144b:b0:39c:eb3b:7e with SMTP id v11-20020a05622a144b00b0039ceb3b007emr32363772qtx.354.1666711470639; Tue, 25 Oct 2022 08:24:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6b+5bl6tBEAfWML+aUWSZ8x0b0MfNlmrJMrUi7by48Pj1nnH12OB9Lq+32okovvq6w+s0rSg== X-Received: by 2002:a05:622a:144b:b0:39c:eb3b:7e with SMTP id v11-20020a05622a144b00b0039ceb3b007emr32363755qtx.354.1666711470439; Tue, 25 Oct 2022 08:24:30 -0700 (PDT) Received: from redhat.com (2603-7000-9500-2e39-0000-0000-0000-1db4.res6.spectrum.com. [2603:7000:9500:2e39::1db4]) by smtp.gmail.com with ESMTPSA id x14-20020a05620a448e00b006ed30a8fb21sm2278759qkp.76.2022.10.25.08.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 08:24:29 -0700 (PDT) Date: Tue, 25 Oct 2022 11:24:28 -0400 From: Marek Polacek To: Jonathan Wakely Cc: Jason Merrill , GCC Patches Subject: Re: [PATCH] c++: Implement -Wdangling-reference [PR106393] Message-ID: References: <20221021232824.1093138-1-polacek@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/2.2.7 (2022-08-07) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Oct 25, 2022 at 12:50:36PM +0100, Jonathan Wakely wrote: > On Sat, 22 Oct 2022 at 00:28, Marek Polacek wrote: > > I've run the testsuite/bootstrap with the warning enabled by default. > > There were just a few FAILs: > > * g++.dg/warn/Wdangling-pointer-2.C > > * 20_util/any/misc/any_cast.cc > > * 20_util/forward/c_neg.cc > > * 20_util/forward/f_neg.cc > > These two are XFAIL tests, they're checking for a required static > assert due to misusing std::forward, so I don't think we want to > change them to remove a "bug" (they're meant to be buggy). > I think they should use -Wno-dangling-reference I think we don't have to do anything: -Wdangling-reference is only enabled by -Wextra and that isn't used in these tests. I was just curious about the warning's impact. > > * experimental/any/misc/any_cast.cc > > all of these look like genuine bugs. A bootstrap with the warning > > enabled by default passed. > > > I've attached a patch for the two any_cast.cc tests that avoids > creating dangling references, without changing the intended behaviour > of the tests. Thanks a lot! Marek