Commit 7e2a12d3 by Josh Conner Committed by Josh Conner

re PR c++/22153 (ICE on invalid template specialization)

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.

From-SVN: r105944
parent fcc85592
2005-10-28 Josh Conner <jconner@apple.com>
PR c++/22153
* parser.c (cp_parser_member_declaration): Detect and handle
a template specialization.
2005-10-28 Andrew Pinski <pinskia@physics.uc.edu>
PR C++/23426
......
......@@ -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;
}
......
2005-10-28 Josh Conner <jconner@apple.com>
PR c++/22153
* g++.dg/template/crash38.C: New test.
* g++.dg/parse/explicit1.C: Change expected errors.
2005-10-28 Andrew Pinski <pinskia@physics.uc.edu>
PR C++/23426
// { dg-do compile }
// PR c++/22153
template<int> void foo();
template<int> struct A
{
template<> friend void foo<0>(); // { dg-error "" }
};
......@@ -7,5 +7,5 @@
struct foo {
template<typename T> void bar (T &t) {}
template<> void bar<double>(double &t) {} // { dg-error "explicit|non-namespace|member" }
template<> void bar<double>(double &t) {} // { dg-error "non-namespace|template|function" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment