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
This commit is contained in:
parent
fcc8559226
commit
7e2a12d3e4
5 changed files with 30 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
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
|
||||
|
|
10
gcc/testsuite/g++.dg/crash38.C
Normal file
10
gcc/testsuite/g++.dg/crash38.C
Normal file
|
@ -0,0 +1,10 @@
|
|||
// { 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" }
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue