* C++ PATCH for c++/81257, ICE with invalid ::template
@ 2017-06-30 21:08 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2017-06-30 21:08 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 275 bytes --]
The change for 54769 caused us to accept this invalid ::template A
even though the scope is non-dependent, so we can do the lookup.
Fixed by reverting part of the change to cp_parser_template_name,
which isn't actually needed.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 81257.diff --]
[-- Type: text/plain, Size: 1200 bytes --]
commit a553e80cfd772d103963b5176af17f9e8232c1c7
Author: Jason Merrill <jason@redhat.com>
Date: Fri Jun 30 16:38:14 2017 -0400
PR c++/81257 - ICE with invalid ::template.
PR c++/54769 - wrong lookup of dependent template-name.
* parser.c (cp_parser_template_name): Revert part of last change.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c6a8e37..575dbfc 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -15911,11 +15911,6 @@ cp_parser_template_name (cp_parser* parser,
/*ambiguous_decls=*/NULL,
token->location);
- /* If the lookup failed and we got the 'template' keyword, believe it. */
- if (decl == error_mark_node && template_keyword_p
- && processing_template_decl)
- return identifier;
-
decl = strip_using_decl (decl);
/* If DECL is a template, then the name was a template-name. */
diff --git a/gcc/testsuite/g++.dg/parse/template-keyword1.C b/gcc/testsuite/g++.dg/parse/template-keyword1.C
new file mode 100644
index 0000000..0a1298e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/template-keyword1.C
@@ -0,0 +1,3 @@
+// PR c++/81257
+
+template < typename ::template A < int > >; // { dg-error "" }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-06-30 21:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30 21:08 C++ PATCH for c++/81257, ICE with invalid ::template Jason Merrill
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).