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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144710
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
/* 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);
+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
void foo()
{
- new A;
+ new A; // { dg-error "default argument" }
}
--- /dev/null
+// 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" }
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" } */
}
void foo()
{
- A().i;
+ A().i; /* { dg-error "default argument" } */
}
template <class T>
void B<T>::g(void) {
- f();
+ f(); // { dg-error "default argument" }
}
template class B<long>;