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 8A97E385840F for ; Wed, 26 Apr 2023 21:16:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A97E385840F 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=1682543769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iH6Sx5U9esw5labYVfhFRwtsTrTi2R30pcl4KRKAd2E=; b=aNQAleZKKvCF8B5ryljmAkVafA4Dmj36XogBlvBijKdaIZVD5KSlriE3puV8h2NbvSvp8e cc5P7ulXAZFOfKJ3pEq0wzr/IIegycX8oe+A3up4IbvgC4k0uDRHF5RnyNsJTZ+XLV5+/L wq7NtwJ8l/N+bwTxWz5OJCJ43/wfnAc= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-283-vuF0_zSVNgqH727Nxk4QVg-1; Wed, 26 Apr 2023 17:16:06 -0400 X-MC-Unique: vuF0_zSVNgqH727Nxk4QVg-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-5ef6b163c80so47708836d6.2 for ; Wed, 26 Apr 2023 14:16:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682543765; x=1685135765; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iH6Sx5U9esw5labYVfhFRwtsTrTi2R30pcl4KRKAd2E=; b=kITgT1D5ial+yQF7qEUwuFnclGtKTMVHldOCb1ddcm+N7t0U/NhCL5GJWDjANOHd7K Ng6HBknj9NeyRrKyl39IORnLucW+4HbCgVNxLgSWE9a/7kfGw+rd246ke2krz7w5470V WBd8Rz4ImEQntTCZSsIpFF/uUL4ynv0ipN1TMUSl+2iy301U0/bqrepOFxHIq93fQ5Z+ Co8S/X901XQHICrcryRckFdrr9W0RIo3/b95upoVIBXPp1/kyW/7VeRMy1yna5OsHeGc LoXC3QSf+rbafPH/1ZTllC0KCZvLS7O/256a5kfuqU4jZML6Q1Z5J5QHTuC6srBJr0sN gEsw== X-Gm-Message-State: AAQBX9cpWUVdLtZfAI3bim9e1FIcYHxmeCEA6FMQWCmAOvxN24FAbq9D xC2u4fVNGcZ9wi4cOAEXOteew0Ict52eMSeGa4XqOwVos042GyOSHwmWzUDgkpYTfnyFfweOpup yl6ToSrzAfR2V8qY/9cGJm/sL4lbRC48lmWWSgwCaxWFNT8fOvbPAaoDLf8+tK7mb5EJlqo2qTg == X-Received: by 2002:a05:6214:2a8f:b0:5ef:5307:1076 with SMTP id jr15-20020a0562142a8f00b005ef53071076mr40290676qvb.4.1682543765462; Wed, 26 Apr 2023 14:16:05 -0700 (PDT) X-Google-Smtp-Source: AKy350a0Yv9f8h4Es2/WzCK2GK3hvxlOGB/7yDl5P2uM2J+gmQFUcxIwmgVjwMJKKIiQHx+xbb8qHQ== X-Received: by 2002:a05:6214:2a8f:b0:5ef:5307:1076 with SMTP id jr15-20020a0562142a8f00b005ef53071076mr40290615qvb.4.1682543764869; Wed, 26 Apr 2023 14:16:04 -0700 (PDT) Received: from jason.com (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 x15-20020a0cda0f000000b005ea7e861d3bsm5070159qvj.145.2023.04.26.14.16.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 14:16:04 -0700 (PDT) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: local class in nested generic lambda [PR109241] Date: Wed, 26 Apr 2023 17:16:02 -0400 Message-Id: <20230426211602.463658-1-jason@redhat.com> X-Mailer: git-send-email 2.31.1 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=-12.9 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_H2,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: Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- The earlier fix for PR109241 avoided the crash by handling a type with no TREE_BINFO. But we want to move toward doing the partial substitution of classes in generic lambdas, so let's take a step in that direction. PR c++/109241 gcc/cp/ChangeLog: * pt.cc (instantiate_class_template): Do partially instantiate. (tsubst_expr): Do call complete_type for partial instantiations. --- gcc/cp/pt.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index e1c272b9817..93a055c66a1 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -12086,7 +12086,8 @@ instantiate_class_template (tree type) return error_mark_node; if (COMPLETE_OR_OPEN_TYPE_P (type) - || uses_template_parms (type)) + || (uses_template_parms (type) + && !TYPE_FUNCTION_SCOPE_P (type))) return type; /* Figure out which template is being instantiated. */ @@ -19356,10 +19357,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) case TAG_DEFN: tmp = tsubst (TREE_TYPE (t), args, complain, NULL_TREE); - if (dependent_type_p (tmp)) - /* This is a partial instantiation, try again when full. */ - add_stmt (build_min (TAG_DEFN, tmp)); - else if (CLASS_TYPE_P (tmp)) + if (CLASS_TYPE_P (tmp)) { /* Local classes are not independent templates; they are instantiated along with their containing function. And this @@ -19368,6 +19366,12 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) /* Closures are handled by the LAMBDA_EXPR. */ gcc_assert (!LAMBDA_TYPE_P (TREE_TYPE (t))); complete_type (tmp); + if (dependent_type_p (tmp)) + { + /* This is a partial instantiation, try again when full. */ + add_stmt (build_min (TAG_DEFN, tmp)); + break; + } tree save_ccp = current_class_ptr; tree save_ccr = current_class_ref; for (tree fld = TYPE_FIELDS (tmp); fld; fld = DECL_CHAIN (fld)) base-commit: 50d866038a910ceb9075b97295a12d77a8d09a3a prerequisite-patch-id: 4ed1b4e9cbee2ce090bd119cbf47056c35aaeb57 prerequisite-patch-id: cd3a881f1b6cd3bca0064002d9a96f2f52c85a79 -- 2.31.1