From patchwork Wed Jan 26 16:39:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1584551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=tymG/L6c; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JkTwn68Jkz9sCD for ; Thu, 27 Jan 2022 03:40:24 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A05F3851405 for ; Wed, 26 Jan 2022 16:40:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A05F3851405 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1643215222; bh=JaD9UMmQB1mEUHVNvMm+YvQxD6vR70sShrQ3y/m1ajs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=tymG/L6cWtduX13kL4FCRnNnIjLmpJXOeY2XrrQKAggqvRNy2N/MyixWSBCRZak0t ggLIMZk2fCSGeNM3/lRkTPLzzkQMyi6CV//qiOxqtqP1rc3tjtHBzF6dEkNND+hLmg 24UI16Dg0UOEMSsbpo47hHXwqg7n1UEtrx0dLr90= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 617A2385780A for ; Wed, 26 Jan 2022 16:39:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 617A2385780A Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-340-94V75epRPQesvs65m7Xnjw-1; Wed, 26 Jan 2022 11:39:35 -0500 X-MC-Unique: 94V75epRPQesvs65m7Xnjw-1 Received: by mail-qv1-f71.google.com with SMTP id f9-20020a0562141d2900b0041e38dbb599so270664qvd.20 for ; Wed, 26 Jan 2022 08:39:35 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=JaD9UMmQB1mEUHVNvMm+YvQxD6vR70sShrQ3y/m1ajs=; b=RNgkQQY404MRjfuEEO+zwDp+xlyZIMAZC+319O3dD9yzPZOGk2MMvN06Ho4S8mis1n CbAITrtA+x70oITaAQZYsG04isfwzZBLGckhiStntnXwDbmzXiW4M3bYR40Pn+KlCVWw rZXzpKGtL6AeRbYhOwCM9AFGRhGyOoLpZZU4BiQZk2aIvgRRLcgvJLiOuY5m/GmzldRH lE4FjkOapcV7+aTYMrs1Y/LDA9D9N6f0B3v8Ic3W3Tt8bAFjpNTlVPQbwXbVwpLByJY2 jFrlsFcxB0vljybZaljZTz3TcSk7evhiPHnCJVGbZ/RvSA7XecLYAxN1e22Vd28ExSIA pz+w== X-Gm-Message-State: AOAM530/ouNdzHmOTjvCPa4wFzsyt531JyddaqSyRZb9848yU+7Urp3S tYglwpyPSfevtjLqUaj01MP44ezU/APcADcApmT7u6Un29s+z1k+Qk93Ow7Bn3pV3lcJsvOACNG rNXCLsNDJQu0r9aLUWy15oTdFTZkfQuA8CKU5HBzCSmXZ11wXTyYBF0Q0Y53Gi/eB0Q== X-Received: by 2002:a05:620a:4622:: with SMTP id br34mr18500620qkb.531.1643215174403; Wed, 26 Jan 2022 08:39:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLQg/KFbOJx8nrIwrYfvvUetWFm0IZNSlfs5GfooOM+/KmgAZKHjH5RKLAWvZPvc6/zxfwHg== X-Received: by 2002:a05:620a:4622:: with SMTP id br34mr18500588qkb.531.1643215173893; Wed, 26 Jan 2022 08:39:33 -0800 (PST) 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 w20sm12015977qkp.102.2022.01.26.08.39.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 08:39:32 -0800 (PST) To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: ->template and using-decl [PR104235] Date: Wed, 26 Jan 2022 11:39:30 -0500 Message-Id: <20220126163930.1196807-1-jason@redhat.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.1 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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-Patchwork-Original-From: Jason Merrill via Gcc-patches From: Jason Merrill Reply-To: Jason Merrill Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" cp_parser_template_id wasn't prepared to handle getting a USING_DECL back from cp_parser_template_name. Let's defer that case to instantiation time, as well. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/104235 gcc/cp/ChangeLog: * parser.cc (cp_parser_template_name): Repeat lookup of USING_DECL. gcc/testsuite/ChangeLog: * g++.dg/parse/template-keyword2.C: New test. --- gcc/cp/parser.cc | 3 ++- gcc/testsuite/g++.dg/parse/template-keyword2.C | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/parse/template-keyword2.C base-commit: 1bc00a489086b0bdde89ccb11dfa4f50b6c4e8f0 prerequisite-patch-id: c7ab4056fcbd782232c8dc091597602ecd4a7a48 diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index ed219d79dc9..8b38165020f 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -18680,7 +18680,8 @@ cp_parser_template_name (cp_parser* parser, cp_parser_error (parser, "expected template-name"); return error_mark_node; } - else if (!DECL_P (decl) && !is_overloaded_fn (decl)) + else if ((!DECL_P (decl) && !is_overloaded_fn (decl)) + || TREE_CODE (decl) == USING_DECL) /* Repeat the lookup at instantiation time. */ decl = identifier; } diff --git a/gcc/testsuite/g++.dg/parse/template-keyword2.C b/gcc/testsuite/g++.dg/parse/template-keyword2.C new file mode 100644 index 00000000000..ecd066787bc --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/template-keyword2.C @@ -0,0 +1,8 @@ +// PR c++/104235 + +template +struct L: M { + using M::a; + void a(); + void p() { this->template a<>(); } +};