mirror of
https://gcc.gnu.org/git/gcc.git
synced 2026-02-22 03:46:53 -05:00
re PR c++/29730 (ICE on invalid declaration of template member)
PR c++/29730 * parser.c (cp_parser_init_declarator): Reject initialization of functions. PR c++/29730 * g++.dg/template/crash64.C: New test. * g++.dg/parse/crash27.C: Adjust error markers. From-SVN: r119632
This commit is contained in:
committed by
Mark Mitchell
parent
ab807d5115
commit
c3d7399cfc
@@ -1,3 +1,9 @@
|
||||
2006-12-06 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/29730
|
||||
* parser.c (cp_parser_init_declarator): Reject initialization of
|
||||
functions.
|
||||
|
||||
2006-12-06 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/29729
|
||||
|
||||
@@ -11238,9 +11238,23 @@ cp_parser_init_declarator (cp_parser* parser,
|
||||
is_non_constant_init = true;
|
||||
if (is_initialized)
|
||||
{
|
||||
if (function_declarator_p (declarator)
|
||||
&& initialization_kind == CPP_EQ)
|
||||
initializer = cp_parser_pure_specifier (parser);
|
||||
if (function_declarator_p (declarator))
|
||||
{
|
||||
if (initialization_kind == CPP_EQ)
|
||||
initializer = cp_parser_pure_specifier (parser);
|
||||
else
|
||||
{
|
||||
/* If the declaration was erroneous, we don't really
|
||||
know what the user intended, so just silently
|
||||
consume the initializer. */
|
||||
if (decl != error_mark_node)
|
||||
error ("initializer provided for function");
|
||||
cp_parser_skip_to_closing_parenthesis (parser,
|
||||
/*recovering=*/true,
|
||||
/*or_comma=*/false,
|
||||
/*consume_paren=*/true);
|
||||
}
|
||||
}
|
||||
else
|
||||
initializer = cp_parser_initializer (parser,
|
||||
&is_parenthesized_init,
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2006-12-07 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/29730
|
||||
* g++.dg/template/crash64.C: New test.
|
||||
* g++.dg/parse/crash27.C: Adjust error markers.
|
||||
|
||||
2006-12-07 Mike Stump <mrs@apple.com>
|
||||
|
||||
* treelang/compile/var_defs.tree: Adjust.
|
||||
|
||||
@@ -3,6 +3,3 @@
|
||||
void Dispatcher()
|
||||
(__builtin_offsetof (ArgsType, largeMsgLen))
|
||||
/* { dg-error "function " "function" { target *-*-* } 4 } */
|
||||
/* { dg-error "expected type" "expected 1" { target *-*-* } 4 } */
|
||||
/* { dg-error "expected `,' before" "expected 2" { target *-*-* } 4 } */
|
||||
/* { dg-error "expected `\\\)" "expected 3" { target *-*-* } 4 } */
|
||||
|
||||
6
gcc/testsuite/g++.dg/template/crash64.C
Normal file
6
gcc/testsuite/g++.dg/template/crash64.C
Normal file
@@ -0,0 +1,6 @@
|
||||
// PR c++/29730
|
||||
|
||||
struct A
|
||||
{
|
||||
template<int> void foo()(0); // { dg-error "initializer" }
|
||||
};
|
||||
Reference in New Issue
Block a user