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 0FA49385840E for ; Mon, 4 Mar 2024 11:00:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FA49385840E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0FA49385840E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709550024; cv=none; b=Sdfohc/AYER3BKIadqrTSGevex8XP/97keAH18UY0ZRJKYGhFPjRhXK9AoW/sZiiPhleDwP3CT4UkbNU7Sqk3Hoef2QPhAR3P8bU6mxqcdG9P7lMtEAxAU6KfQ4QDJMDBsTsjPGIIiYSY3gvJjSpZWOrqv0lO7IgXxiTBDb7+Ro= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709550024; c=relaxed/simple; bh=bfATm8H0/dvv10cTyLOEknH8K1gZ/hLceB6sCYKtiQg=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=G6HRcmebkZStacHAFPYNQUsnmLZ391tmd2YGY7sOeJcwstpwVn01NLaqv84FC/v1Gd6fZl6LznLWrG4YIwROz2fArqkwOJXhZN7VhzH3Fn615OGS6+ZZfogcBoE5P0bprAX2hO3J34LbNHajh/7+dwOqwoHYo/A5RXFRQcw46aA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709550021; 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=si40LVtWsZ99lyOUcSJMm9eaVXltSNevLn1YE9EgGQA=; b=TOLMYtf3/LVQHxsktczJMe1r/PK71DpzOOyZp/ydshNsHvGOkSFdma2YNCjLeU/ZTR+7aZ mjEbmzwN8rxoNuxRD+ghNZ06zO3kjIh2g1NraQFXOxjV90PhDdH6053SDU0xp1SpCTg9Uv gT5OQQLGyQrSnrVtdV/bBpufds+7s2w= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-LsiobmSgODGiY3fFUC9yew-1; Mon, 04 Mar 2024 06:00:20 -0500 X-MC-Unique: LsiobmSgODGiY3fFUC9yew-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DAEA385A58E for ; Mon, 4 Mar 2024 11:00:19 +0000 (UTC) Received: from localhost (unknown [10.42.28.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79B3E2166B35; Mon, 4 Mar 2024 11:00:19 +0000 (UTC) Date: Mon, 4 Mar 2024 11:00:18 +0000 From: Jonathan Wakely To: Marek Polacek Cc: GCC Patches , Jason Merrill Subject: Re: [PATCH v5] c++: implement [[gnu::non_owning]] [PR110358] Message-ID: References: <20240126013736.70125-1-polacek@redhat.com> <0e4c47b6-604c-4d30-b458-825959c0e1d6@redhat.com> <584f955c-14eb-40b2-9365-a02279c3a763@redhat.com> MIME-Version: 1.0 In-Reply-To: <584f955c-14eb-40b2-9365-a02279c3a763@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 List-Id: On 01/03/24 15:38 -0500, Jason Merrill wrote: >On 3/1/24 14:24, Marek Polacek wrote: >>+@smallexample >>+template >>+[[gnu::no_dangling(std::is_reference_v)]] int foo (T& t) @{ > >I think this function should return a reference. The condition in the attribute can only ever be true if you call this function with an explicit template argument list: foo(i). Is that intentional? And if T is non-const it can't be called with a temporary and so dangling seems less of a problem for this function anyway, right? Would it make more sense as something like this? template [[gnu::no_dangling(std::is_lvalue_reference_v)]] decltype(auto) foo(T&& t) { ... } Or is this getting too complex/subtle for a simple example?