From 1aca07e94eed9723d35906259e019b609b974ed4 Mon Sep 17 00:00:00 2001 From: lerdsuwa Date: Fri, 5 Dec 2003 14:44:59 +0000 Subject: [PATCH] PR c++/13166 * parser.c (cp_parser_late_parsing_default_args): Make sure the context is a class before calling push_nested_class and pop_nested_class. * g++.dg/parse/defarg6.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74333 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 19 +++++++++++++------ gcc/cp/parser.c | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/parse/defarg6.C | 11 +++++++++++ 4 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/parse/defarg6.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 33a772f..6e2239b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2003-12-05 Kriang Lerdsuwanakij + + PR c++/13166 + * parser.c (cp_parser_late_parsing_default_args): Make sure the + context is a class before calling push_nested_class and + pop_nested_class. + 2003-12-03 James E Wilson * g++spec.c (lang_specific_driver): Delete USE_LIBUNWIND_EXCEPTIONS @@ -24,15 +31,15 @@ 2003-12-02 Giovanni Bajo - PR c++/10126 - * pt.c (convert_nontype_argument): Handle default conversions - while converting a pointer to member function. + PR c++/10126 + * pt.c (convert_nontype_argument): Handle default conversions + while converting a pointer to member function. 2003-12-02 Giovanni Bajo - PR c++/12573 - * pt.c (value_dependent_expression_p): Handle COMPONENT_REFs by - looking into them recursively. + PR c++/12573 + * pt.c (value_dependent_expression_p): Handle COMPONENT_REFs by + looking into them recursively. 2003-12-02 Richard Henderson diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 1ce8cd78..5f1b473 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -14239,10 +14239,10 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) saved_local_variables_forbidden_p = parser->local_variables_forbidden_p; parser->local_variables_forbidden_p = true; /* Parse the assignment-expression. */ - if (DECL_CONTEXT (fn)) + if (DECL_CLASS_SCOPE_P (fn)) push_nested_class (DECL_CONTEXT (fn)); TREE_PURPOSE (parameters) = cp_parser_assignment_expression (parser); - if (DECL_CONTEXT (fn)) + if (DECL_CLASS_SCOPE_P (fn)) pop_nested_class (); /* Restore saved state. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5a00a7a..376783e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-12-05 Kriang Lerdsuwanakij + + PR c++/13166 + * g++.dg/parse/defarg6.C: New test. + 2003-12-05 Hans-Peter Nilsson PR target/13256 diff --git a/gcc/testsuite/g++.dg/parse/defarg6.C b/gcc/testsuite/g++.dg/parse/defarg6.C new file mode 100644 index 0000000..827b605 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/defarg6.C @@ -0,0 +1,11 @@ +// { dg-do compile } + +// Origin: Falk Hueffner + +// PR c++/13166: ICE default function argument for friend declaration. + +namespace sc_dt { + class sc_length_param { + friend int compare_unsigned(int if_v_signed = 0) {} + }; +} -- 2.7.4