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 C6D68385840D for ; Tue, 23 Apr 2024 17:29:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C6D68385840D 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 C6D68385840D 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=1713893349; cv=none; b=iP1ze3ViICH0Wk14khk9AqR7ojxOjypdEwXgjZpyYX9h/drxfA3CGCX4LHFt3UQdPs1bHHv9b6NqRXdDrY6a60Pv236CciJ9XQELkINKz7ddnUHQBUpV+Zih9iaX9SOerihHx3oJf2a/Z0TNjHECe0Dd8UzVylCMcd9ZKSPiejI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713893349; c=relaxed/simple; bh=ZGY8ksQkj2PKDx1AM0sf5ME//hYI8xrzui9xAbXs7Hg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=hQdg78nBIOgSwJN3Y+CKBoVfPUW7i4dq1Xqnn6aZZUbcvhnlh4MCF0sz7LSTWbzW7blSq30DUrnAKv0wIClsAwvSR6JzqlN3kGO69SkZma1gFesSgNzGl1t6ItXIMjRLammmGGtndxVDoA2kOIZ7xdhqLPfjWNVRBCUDjE1N8UQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713893347; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Bl4kAX+pbiqN7eDLimPbjOojEqkQXp85TcbBHRMiOkk=; b=DfeHlHc29SuRju+mc81N00QqbxU8ookZgySBU6XscYT2JF3Nte/Gk+7D8XH5F5/JM7akTy bs/ngb6Y8cLNGuvX7fWl7W6wwEv4zuwQNQvjWXldh20hzmF9JSmoCTI1Sai5mQZabaJBAj 6IRhrsDCwtQgeEYXZ1VMe0UK2k1MzgI= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-381-KjxYDhBkOXaoDppCkylLkA-1; Tue, 23 Apr 2024 13:29:06 -0400 X-MC-Unique: KjxYDhBkOXaoDppCkylLkA-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-78d5ef6055fso847495285a.1 for ; Tue, 23 Apr 2024 10:29:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713893345; x=1714498145; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Bl4kAX+pbiqN7eDLimPbjOojEqkQXp85TcbBHRMiOkk=; b=NCHX0s4F/cg9lp9GEk5krW1eMetg5aP8zS3XJgCHY3jm5lD4sBSJrH0KqFE+NljsCG kVSfONnlFkpZvEK1ETItXIYBHTA7PFuA6BX+I8I0I7zpOfvkBG1i93/0NoY/jYH0Ddok 3jGxNhoPZVTkKBe8pcJFJ7ndMIiFb8bIB0+geyqjm7bNWDpl60xjiWnutr7ZPAFn7WtF DtA4GSqSWzugm3IKiHgyUVFDGcN6EfFL3pohpeBo9yhz1HSZNisCiXMH9QeEAANtnYKz tbBZM63zNMoVXKxse9eDiP4WpBGbDp0H018ocSk1vTxZkMWZBe1IPrRBIjt0lyTRVeUB CMTg== X-Forwarded-Encrypted: i=1; AJvYcCUS+Z6S/RzEKJ3g4U/JJQNXl6EbMQ6Dvg/Hi0ITNWK4jXBayFmhdomG5RQxtYPn5sVkiEFHgeIiUPRIJfOSlbQmClWnMrSinQ== X-Gm-Message-State: AOJu0YxmWDQE8j5X2ZLsB0/41hPD8yn5tEiyzWwHilYiZQs6dcKOE7D0 D8vnkEUze7GJxCyz1UwzfGG9dNQ5wS3D79KPX9m6iZQfOTTQ3vJ3YVY1LgQauusa4vMC197askg 4J7ZdXhkkqzFH89Zq020yB8MMkKrXhZ8qnktX2bWaqKPIFq+kWJzsTkk= X-Received: by 2002:ae9:e712:0:b0:78f:1999:debf with SMTP id m18-20020ae9e712000000b0078f1999debfmr112619qka.50.1713893345666; Tue, 23 Apr 2024 10:29:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIIsDWjnIogFenf3OyDvX7vsZu4ePWsf3mq/roaDXMUwmawIXF++yP1Zq7h7gORqkYtmKE8A== X-Received: by 2002:ae9:e712:0:b0:78f:1999:debf with SMTP id m18-20020ae9e712000000b0078f1999debfmr112597qka.50.1713893345358; Tue, 23 Apr 2024 10:29:05 -0700 (PDT) Received: from [192.168.1.130] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id q24-20020a05620a0c9800b0078d677e72f3sm5447836qki.118.2024.04.23.10.29.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Apr 2024 10:29:04 -0700 (PDT) Message-ID: <468ca4fe-710f-4524-a976-9774a0452817@redhat.com> Date: Tue, 23 Apr 2024 13:29:04 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] c++/modules: deduced return type merging [PR114795] To: Patrick Palka , gcc-patches@gcc.gnu.org Cc: nathanieloshead@gmail.com References: <20240423164101.3016046-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20240423164101.3016046-1-ppalka@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: 7bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,URIBL_BLACK 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 4/23/24 09:41, Patrick Palka wrote: > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? > > -- >8 -- > > When merging an imported function template specialization with an > existing one, if the existing one has an undeduced return type and the > imported one's is already deduced, we need to propagate the deduced type > since once we install the imported definition we won't get a chance to > deduce it by normal means. > > This patch makes is_matching_decl propagate the deduced return type > alongside the existing propagate of the existing specification. I > suppose could instead propagate it later when installing the imported > definition from read_definition, but it seems best to propagate it > sooner rather than later. > > PR c++/114795 > > gcc/cp/ChangeLog: > > * module.cc (trees_in::is_matching_decl): Propagate deduced > function return type. > > gcc/testsuite/ChangeLog: > > * g++.dg/modules/auto-4_a.H: New test. > * g++.dg/modules/auto-4_b.C: New test. > --- > gcc/cp/module.cc | 5 +++++ > gcc/testsuite/g++.dg/modules/auto-4_a.H | 14 ++++++++++++++ > gcc/testsuite/g++.dg/modules/auto-4_b.C | 15 +++++++++++++++ > 3 files changed, 34 insertions(+) > create mode 100644 gcc/testsuite/g++.dg/modules/auto-4_a.H > create mode 100644 gcc/testsuite/g++.dg/modules/auto-4_b.C > > diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc > index d94d8ff4df9..e10e19ac9f7 100644 > --- a/gcc/cp/module.cc > +++ b/gcc/cp/module.cc > @@ -11537,6 +11537,11 @@ trees_in::is_matching_decl (tree existing, tree decl, bool is_typedef) > else if (!DEFERRED_NOEXCEPT_SPEC_P (d_spec) > && !comp_except_specs (d_spec, e_spec, ce_type)) > goto mismatch; > + > + /* Similarly if EXISTING has an undeduced return type, but DECL's > + is already deduced. */ > + if (undeduced_auto_decl (existing) && !undeduced_auto_decl (decl)) > + TREE_TYPE (existing) = change_return_type (TREE_TYPE (d_type), e_type); Perhaps this should dump a note like the noexcept merge does? OK either way. Jason