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.129.124]) by sourceware.org (Postfix) with ESMTPS id A0CB93857353 for ; Tue, 25 Oct 2022 13:14:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A0CB93857353 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=1666703668; 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=2a40mJrhpqQ3rufiFpdllKQJfKYelgoi8HD8X4GVxzU=; b=PmyctvYDYagiWQhK8KMjdoXHKPdzZoqkR2Vj25TGxjgGEyxiZJALcapT2buaMBtsd/ZPCP L2c9jiS4KXain1QukcsdGsCgJQMSCoQjZvUHyNdDeeUE9w3iY8t0AWagbzeqe0NQ2TYaSF 0YkAhvg+MrRwTnKWB0avd56jniFNbC8= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-563-NjHdUt1SMM2qfi7P4-j0oQ-1; Tue, 25 Oct 2022 09:14:26 -0400 X-MC-Unique: NjHdUt1SMM2qfi7P4-j0oQ-1 Received: by mail-qk1-f200.google.com with SMTP id ay43-20020a05620a17ab00b006f7ee90098aso1003983qkb.11 for ; Tue, 25 Oct 2022 06:14:26 -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=2a40mJrhpqQ3rufiFpdllKQJfKYelgoi8HD8X4GVxzU=; b=W3UjYSS0z8qmquQ34UBGDFoKq7XYvFuD2YZehsfcW7CRvsrjtsm1PRVtIZs5MqVzu6 DVienrUquq1MTYRkFkCHsK/UlqZs+FJL5wb16ugfTdKQ/ERdP6aS1GkrbND0nxra4OEw lpaFIC4dNuICl9UAbkDk6oRicgt545Q05MmCToRdOC+ja/aCmQ1oJNpJD+dmFyvEUwYD LT0Kx+5Loh97G+DTL1CfsiCngE4FqdqkHu1CBgiG69nWFY2fPPjVWOtwa4t/7nEffyj3 T0zB78kGLjpZ8sOi1LBn5/kPU+bIExhie/vMAFNmb1/1GAjcdaFth89RJfsKPRWsKk3j ItXQ== X-Gm-Message-State: ACrzQf0SxzYzRMoNituk+EF6lmAdUMLcKUjGt9CAY+Hm8XXOPgKix30I FRd3wNjkAmLtKOgh0jsY5G0Xx75JRFdFNkQamf3cbLAtqI7JWkGDjNtqHJrgQ1bCpxCEsT3UWFA yjj4hufAD559ye7yzQg== X-Received: by 2002:a05:622a:1705:b0:39c:ca5f:5d53 with SMTP id h5-20020a05622a170500b0039cca5f5d53mr32144693qtk.67.1666703665653; Tue, 25 Oct 2022 06:14:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4wN/T3Sh9zKHpHxn3XLzUyU8g/Rozz0RnN4Eu3huPljLKUy892AvfJ0b8/ewVleO7D9EeYaA== X-Received: by 2002:a05:622a:1705:b0:39c:ca5f:5d53 with SMTP id h5-20020a05622a170500b0039cca5f5d53mr32144678qtk.67.1666703665429; Tue, 25 Oct 2022 06:14:25 -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 ga20-20020a05622a591400b003996aa171b9sm1510010qtb.97.2022.10.25.06.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 06:14:24 -0700 (PDT) Date: Tue, 25 Oct 2022 09:14:22 -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:34:50PM +0100, Jonathan Wakely wrote: > On Mon, 24 Oct 2022 at 18:30, Jason Merrill wrote: > > > > On 10/21/22 19:28, Marek Polacek wrote: > > > When testing a previous version of the patch, there were many FAILs in > > > libstdc++'s 22_locale/; all of them because the warning triggered on > > > > > > const test_type& obj = std::use_facet(std::locale()); > > > > > > but this code looks valid -- std::use_facet doesn't return a reference > > > to its parameter. Therefore I added code to suppress the warning when > > > the call is std::use_facet. Now 22_locale/* pass even with the warning > > > on. We could exclude more std:: functions like this if desirable. > > > > Instead of adding special cases in the compiler, let's disable the > > warning around the definition of use_facet (and adjust the compiler as > > needed so that avoids the warning). > > I assume you mean using #pragma here. If we disable it around the > definition of use_facet, will that disable it for callers of > use_facet, or only within the definition of use_facet itself? Right, a #pragma will not help, it would only disable the warning within the definition of use_facet itself. Another way would be to use some kind of attribute on use_facet but I didn't find any that would be relevant in this scenario (so I guess we'd have to add one). Marek