From: Jason Merrill <jason@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [pushed] c++: dependent conversion operator lookup [PR106179]
Date: Wed, 6 Jul 2022 00:39:59 -0400 [thread overview]
Message-ID: <20220706043959.1296333-1-jason@redhat.com> (raw)
In-Reply-To: <20220701145116.906999-1-jason@redhat.com>
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 <typename> Mat();
+};
+template <typename> struct Mat_;
+template <typename _Tp> Mat::Mat() {
+ _Tp commaInitializer = commaInitializer.operator Mat_<_Tp>;
+}
base-commit: 510ac273a785361f7c8f24e4815bfb477a6a2e07
--
2.27.0
prev parent reply other threads:[~2022-07-06 4:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-01 14:51 [pushed] c++: dependent generic lambda template-id [PR106024] Jason Merrill
2022-07-06 4:39 ` Jason Merrill [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220706043959.1296333-1-jason@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).