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.133.124]) by sourceware.org (Postfix) with ESMTPS id 9D3033857806 for ; Wed, 6 Jul 2022 04:40:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9D3033857806 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-314-neA1mzrSN_GXO2tNPRRYiw-1; Wed, 06 Jul 2022 00:40:02 -0400 X-MC-Unique: neA1mzrSN_GXO2tNPRRYiw-1 Received: by mail-qt1-f199.google.com with SMTP id d4-20020ac86144000000b00319586f86fcso11244816qtm.16 for ; Tue, 05 Jul 2022 21:40:02 -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=zt8y+Khj4gBf/ehbhtiWNzjY7At5StG8sy+C3FruFPY=; b=4VZWYkvA9WEXvOndoVnLEwxFKs89m8XYLU/uzwws8N2jk3tfW3xsBBupRa7d6A7ggC XuXG98sm52kO0aYBreG5G16NUh0OjJ4ngTHJFP/AVgBMd+PGj03ZJA5OFYQOfXpVB/Ow bDIizjypXu2W59KNr5Xn9fPc0c+t1CcN7TXxV1YR+SeEGZFA50rlkxqcjLIfo6iuUNWI wHQAhBTjEcLXHFSwIqK1h+X4vWfD1kdhADQj8rx/9fHP14xciqiHhdxAKhkjdtBoJtq4 RWCN4YY/ktVXNiQpjCF8RS35peuXMkRfiVIz+ER34vGzZqy1RSh53qPl8vho1eI9wJHC Ucpw== X-Gm-Message-State: AJIora8ZeUjyU8MbewF43CvpX+ySSRVf3+kohSnQ5h3JHGFXX6rLm40f T7TLaCEiRNVQgukVNh5KtXC9B3gFyAxQq0RLkKygqTyvWlMBRNQdMY0YaY0Ccoelv7KPZKy18NC wL8xi1tOGJeMK5Mh/A2xp9RsTL+Wbp/x9C4f+XyCKlH7sh1SO9SHdUak5rrBzCU55Hg== X-Received: by 2002:ad4:5765:0:b0:473:20e:746c with SMTP id r5-20020ad45765000000b00473020e746cmr6840967qvx.128.1657082402099; Tue, 05 Jul 2022 21:40:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1soMGnDVXtsfoBWp3BnJJyX7p83zkyNYCG2STKyzf9o05O+j3Xewu0C0QOaFF+pagG5NVDGlw== X-Received: by 2002:ad4:5765:0:b0:473:20e:746c with SMTP id r5-20020ad45765000000b00473020e746cmr6840953qvx.128.1657082401730; Tue, 05 Jul 2022 21:40:01 -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 l7-20020a05620a28c700b006b47dc92e15sm5242336qkp.36.2022.07.05.21.40.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 21:40:01 -0700 (PDT) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: dependent conversion operator lookup [PR106179] Date: Wed, 6 Jul 2022 00:39:59 -0400 Message-Id: <20220706043959.1296333-1-jason@redhat.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220701145116.906999-1-jason@redhat.com> References: <20220701145116.906999-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.2 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, 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: Wed, 06 Jul 2022 04:40:12 -0000 This testcase demonstrates that my assumption that we would only be interested in a class template lookup if the template-id is followed by :: was wrong. PR c++/106179 PR c++/106024 gcc/cp/ChangeLog: * parser.cc (cp_parser_lookup_name): Remove :: requirement for using unqualified lookup result. gcc/testsuite/ChangeLog: * g++.dg/template/operator16.C: New test. --- gcc/cp/parser.cc | 4 ---- gcc/testsuite/g++.dg/template/operator16.C | 9 +++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/operator16.C diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index df657a3fb2b..5cd6a527d93 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -30738,10 +30738,6 @@ cp_parser_lookup_name (cp_parser *parser, tree name, looking at a template arg list. */ if (!cp_parser_skip_entire_template_parameter_list (parser)) decl = NULL_TREE; - /* And only use the unqualified lookup if we're looking at ::. */ - if (decl - && !cp_lexer_next_token_is (parser->lexer, CPP_SCOPE)) - decl = NULL_TREE; } /* If we know we're looking for a type (e.g. A in p->A::x), diff --git a/gcc/testsuite/g++.dg/template/operator16.C b/gcc/testsuite/g++.dg/template/operator16.C new file mode 100644 index 00000000000..434a266850c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/operator16.C @@ -0,0 +1,9 @@ +// PR c++/106179 + +struct Mat { + template Mat(); +}; +template struct Mat_; +template Mat::Mat() { + _Tp commaInitializer = commaInitializer.operator Mat_<_Tp>; +} base-commit: 510ac273a785361f7c8f24e4815bfb477a6a2e07 -- 2.27.0