aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-03-08 18:47:42 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-03-08 18:47:42 +0000
commit0e1363428da6b1ff7d0f20d730e5fd76a29241ed (patch)
treeac2ca092904548ecb5c41cd9e875ffc991c35ea8 /gcc/cp/parser.c
parent988d1653869158be80b797b13a60dacfc0a4fa22 (diff)
downloadgcc-0e1363428da6b1ff7d0f20d730e5fd76a29241ed.zip
gcc-0e1363428da6b1ff7d0f20d730e5fd76a29241ed.tar.gz
gcc-0e1363428da6b1ff7d0f20d730e5fd76a29241ed.tar.bz2
re PR c++/9823 (ICE in sort_mem_initializers)
PR c++/9823 * cp-tree.h (begin_mem_initializers): Remove. * parser.c (cp_parser_mem_initializer_list): Inline it here. Do not call finish_mem_initializers if not in a constructor. (cp_parser_class_head): Fix typo in error message. * semantics.c (begin_mem_initializers): Remove. * testsuite/g++.dg/parser/constructor1.C: New test. PR c++/9823 * g++.dg/parser/constructor1.C: New test. From-SVN: r63999
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 468ba03b..1c83227 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -7189,7 +7189,8 @@ cp_parser_mem_initializer_list (cp_parser* parser)
/* Let the semantic analysis code know that we are starting the
mem-initializer-list. */
- begin_mem_initializers ();
+ if (!DECL_CONSTRUCTOR_P (current_function_decl))
+ error ("only constructors take base initializers");
/* Loop through the list. */
while (true)
@@ -7212,7 +7213,8 @@ cp_parser_mem_initializer_list (cp_parser* parser)
}
/* Perform semantic analysis. */
- finish_mem_initializers (mem_initializer_list);
+ if (DECL_CONSTRUCTOR_P (current_function_decl))
+ finish_mem_initializers (mem_initializer_list);
}
/* Parse a mem-initializer.
@@ -11789,7 +11791,7 @@ cp_parser_class_head (cp_parser* parser,
class was originally declared, the program is invalid. */
if (scope && !is_ancestor (scope, CP_DECL_CONTEXT (type)))
{
- error ("declaration of `%D' in `%D' which does not "
+ error ("declaration of `%D' in `%D' which does not "
"enclose `%D'", type, scope, nested_name_specifier);
return NULL_TREE;
}