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 3C003381DC78 for ; Thu, 23 Jun 2022 03:22:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3C003381DC78 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-657-yjzH09fWPP-We1Pv692rRw-1; Wed, 22 Jun 2022 23:22:54 -0400 X-MC-Unique: yjzH09fWPP-We1Pv692rRw-1 Received: by mail-qv1-f69.google.com with SMTP id e10-20020a0ce3ca000000b004702b8819beso15155800qvl.4 for ; Wed, 22 Jun 2022 20:22:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cYWWLDcaTIkcJWTb79pAca21ZHFR9+vKDFIQa8emR+Q=; b=uBj4HEsZXK3NSlltkAVZHhLZ7oQ/MSLw9cwZSyXk+rxRwj2Z+fJyZi/biSXGkkb/nD mIOS+s8TRgGvAgKB4XEbMC9HfZ73bZ+rG+SvJMnxSOgc338W8yUunBBxsIZp0Vqk/qoX 5dBTbFAtGEPBf2eMxqKbQvbDIuYKwlmu58XMe58jGZyeKYhnCpEbj5XI18r9zqTng474 RZZr/85FZNabRQ9zspfYwwTnTdMEo9EaJOzaINhwdAwYoD7Tv7QUCDmIFtEnHrVdA96p XcdBnLrgBTfrGbNMTAsYij/SzFY2FxUqPH9W/cLTwWrL/oBx/CEoKxf7ZaH4qNw73FPy 6YQQ== X-Gm-Message-State: AJIora9i+1AUEzXSPfw5MRoENMCg65isMhs9vIAEoohyOzVX6SFEBkiE hQjFchntAhMEzTq1kD5hLC2Kz7Z6qDN153qjm/uVk3WJXnd/t47tNyCBkthRYhwreXosBz4R3C9 r4sqYBYVF1S3urcEDEz1P8Bnd44fHS1JDDJmmq6m5tlISe8t/o0h/V8OapChDkZuQJw== X-Received: by 2002:a05:6214:e84:b0:470:3e94:a85c with SMTP id hf4-20020a0562140e8400b004703e94a85cmr18032162qvb.11.1655954573898; Wed, 22 Jun 2022 20:22:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vzHYqIcgCgOwx6YCV56LNllzryTJ55VlRP/0U6Mm61d5dM14UX7HDbvU7OBeNkoRJqsa6/JA== X-Received: by 2002:a05:6214:e84:b0:470:3e94:a85c with SMTP id hf4-20020a0562140e8400b004703e94a85cmr18032147qvb.11.1655954573485; Wed, 22 Jun 2022 20:22:53 -0700 (PDT) Received: from barrymore.redhat.com (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id ey6-20020a05622a4c0600b0030a9dfb2898sm9400578qtb.85.2022.06.22.20.22.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jun 2022 20:22:53 -0700 (PDT) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: tweak deduction with auto template parms Date: Wed, 22 Jun 2022 23:22:51 -0400 Message-Id: <20220623032251.49288-1-jason@redhat.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220623032123.48962-1-jason@redhat.com> References: <20220623032123.48962-1-jason@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.5 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_LOW, 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: Thu, 23 Jun 2022 03:22:57 -0000 While looking at PR105964 I noticed that we were unnecessarily repeating the deduction loop because of seeing a non-type parameter with type 'auto'. It is indeed dependent, but not on any other deductions. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog: * pt.cc (type_unification_real): An auto tparm can't be affected by other deductions. --- gcc/cp/pt.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 4d1c325432d..80d2bec2348 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -22982,6 +22982,7 @@ type_unification_real (tree tparms, deduced from a later argument than the one from which this parameter can be deduced. */ if (TREE_CODE (tparm) == PARM_DECL + && !is_auto (TREE_TYPE (tparm)) && uses_template_parms (TREE_TYPE (tparm)) && saw_undeduced < 2) { @@ -23042,6 +23043,7 @@ type_unification_real (tree tparms, if (saw_undeduced == 1 && TREE_CODE (parm) == PARM_DECL + && !is_auto (TREE_TYPE (parm)) && uses_template_parms (TREE_TYPE (parm))) { /* The type of this non-type parameter depends on undeduced base-commit: 349a39f061407ce2339d2ba25da97005f2030c88 prerequisite-patch-id: d5622f522428b601200c8c234ddb5e58c91dcb06 -- 2.27.0