diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2009-03-08 17:29:12 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2009-03-08 10:29:12 -0700 |
commit | ae9b2a481c0f6510271cf12f86cd3b6b86490a96 (patch) | |
tree | 5629a4fada17111aca9ed99113dd06ed98c105e2 | |
parent | 975a4fd69f8d84b2414445745195d0b6ced3a39c (diff) | |
download | gcc-ae9b2a481c0f6510271cf12f86cd3b6b86490a96.zip gcc-ae9b2a481c0f6510271cf12f86cd3b6b86490a96.tar.gz gcc-ae9b2a481c0f6510271cf12f86cd3b6b86490a96.tar.bz2 |
re PR c++/39060 (ICE with lots of invalid member functions)
gcc/cp/
2009-03-08 H.J. Lu <hongjiu.lu@intel.com>
PR c++/39060
* parser.c (cp_parser_late_parsing_default_args): Continue
the loop when cp_parser_assignment_expression returns
error_mark_node.
gcc/testsuite/
2009-03-08 H.J. Lu <hongjiu.lu@intel.com>
PR c++/39060
* g++.dg/other/new1.C: Adjusted.
* g++.dg/parse/crash40.C: Likewise.
* g++.dg/parse/defarg12.C: Likewise.
* g++.dg/template/error15.C: Likewise.
* g++.dg/other/pr39060.C: New.
From-SVN: r144710
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/parser.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/new1.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/pr39060.C | 19 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/crash40.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/defarg12.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/error15.C | 2 |
8 files changed, 45 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 368843f..c4b151b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2009-03-08 H.J. Lu <hongjiu.lu@intel.com> + + PR c++/39060 + * parser.c (cp_parser_late_parsing_default_args): Continue + the loop when cp_parser_assignment_expression returns + error_mark_node. + 2009-03-07 Jason Merrill <jason@redhat.com> PR c++/39367 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 5c5c912..4c6fd4a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -18291,6 +18291,11 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) /* Parse the assignment-expression. */ parsed_arg = cp_parser_assignment_expression (parser, /*cast_p=*/false, NULL); + if (parsed_arg == error_mark_node) + { + cp_parser_pop_lexer (parser); + continue; + } if (!processing_template_decl) parsed_arg = check_default_argument (TREE_VALUE (parm), parsed_arg); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1b7a69d..3d44d64 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2009-03-08 H.J. Lu <hongjiu.lu@intel.com> + + PR c++/39060 + * g++.dg/other/new1.C: Adjusted. + * g++.dg/parse/crash40.C: Likewise. + * g++.dg/parse/defarg12.C: Likewise. + * g++.dg/template/error15.C: Likewise. + + * g++.dg/other/pr39060.C: New. + 2009-03-07 Jason Merrill <jason@redhat.com> PR c++/39367 diff --git a/gcc/testsuite/g++.dg/other/new1.C b/gcc/testsuite/g++.dg/other/new1.C index 30b6513..7138370 100644 --- a/gcc/testsuite/g++.dg/other/new1.C +++ b/gcc/testsuite/g++.dg/other/new1.C @@ -10,5 +10,5 @@ struct A void foo() { - new A; + new A; // { dg-error "default argument" } } diff --git a/gcc/testsuite/g++.dg/other/pr39060.C b/gcc/testsuite/g++.dg/other/pr39060.C new file mode 100644 index 0000000..a625aea --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr39060.C @@ -0,0 +1,19 @@ +// PR c++/39060 +// { dg-do compile } + +struct A +{ + A(void* i=); // { dg-error "with|specification" } + A(void* i=); // { dg-error "overloaded" } + A(void* i=); // { dg-error "overloaded" } + + void operator+ (void* i=); // { dg-error "arguments" } + + virtual void foo1(=); // { dg-error "identifier" } + void foo2(=); // { dg-error "identifier" } + void foo3(=); // { dg-error "identifier" } + void foo4(=); // { dg-error "identifier" } + void foo5(=); // { dg-error "identifier" } +}; // { dg-error "primary-expression" } + +A::A (void* i=) {} // { dg-error "primary-expression|argument" } diff --git a/gcc/testsuite/g++.dg/parse/crash40.C b/gcc/testsuite/g++.dg/parse/crash40.C index af44fdb..6a15228 100644 --- a/gcc/testsuite/g++.dg/parse/crash40.C +++ b/gcc/testsuite/g++.dg/parse/crash40.C @@ -37,6 +37,6 @@ void bar() int i; i.C::foo<0>(); /* { dg-error "which is of non-class type" } */ - S<false> s; + S<false> s; /* { dg-error "default argument" } */ SS<false> ss; /* { dg-error "within this context" } */ } diff --git a/gcc/testsuite/g++.dg/parse/defarg12.C b/gcc/testsuite/g++.dg/parse/defarg12.C index 3717ad5..80ef5c3 100644 --- a/gcc/testsuite/g++.dg/parse/defarg12.C +++ b/gcc/testsuite/g++.dg/parse/defarg12.C @@ -9,5 +9,5 @@ struct A void foo() { - A().i; + A().i; /* { dg-error "default argument" } */ } diff --git a/gcc/testsuite/g++.dg/template/error15.C b/gcc/testsuite/g++.dg/template/error15.C index 6bd1f77..b7c7bc8c 100644 --- a/gcc/testsuite/g++.dg/template/error15.C +++ b/gcc/testsuite/g++.dg/template/error15.C @@ -18,7 +18,7 @@ protected: template <class T> void B<T>::g(void) { - f(); + f(); // { dg-error "default argument" } } template class B<long>; |