summaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorjconner <jconner@138bc75d-0d04-0410-961f-82ee72b054a4>2005-10-28 17:58:59 +0000
committerjconner <jconner@138bc75d-0d04-0410-961f-82ee72b054a4>2005-10-28 17:58:59 +0000
commit81ef2172af6245487cf4d5be22a85b89d9516f2d (patch)
tree3ef076b94d5b9ef432db0cfe490255efa7f21605 /gcc/cp/parser.c
parentc6d229168bc9d5347b670e893ced43cd61a79c14 (diff)
downloadgcc-81ef2172af6245487cf4d5be22a85b89d9516f2d.tar.gz
PR c++/22153
* cp/parser.c (cp_parser_member_declaration): Detect and handle a template specialization. * testsuite/g++.dg/template/crash38.C: New test. * testsuite/g++.dg/parse/explicit1.C: Change expected errors. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105944 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 25f25ce69ec..a065c2569ac 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -13240,8 +13240,13 @@ cp_parser_member_declaration (cp_parser* parser)
/* Check for a template-declaration. */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TEMPLATE))
{
- /* Parse the template-declaration. */
- cp_parser_template_declaration (parser, /*member_p=*/true);
+ /* An explicit specialization here is an error condition, and we
+ expect the specialization handler to detect and report this. */
+ if (cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_LESS
+ && cp_lexer_peek_nth_token (parser->lexer, 3)->type == CPP_GREATER)
+ cp_parser_explicit_specialization (parser);
+ else
+ cp_parser_template_declaration (parser, /*member_p=*/true);
return;
}