+2006-10-12 Lee Millward <lee.millward@codesourcery.com>
+
+ PR c++/27961
+ * decl.c (start_decl): Return error_mark_node if a
+ function is initialized like a variable.
+ (check_var_type): If a variable of field is declared void,
+ set the type to error_mark_node.
+ (grokdeclarator): Check the return type of check_var_type.
+ * class.c (finish_struct_1): Robustify.
+
2006-10-11 Mark Mitchell <mark@codesourcery.com>
PR c++/29175
working on. */
for (x = TYPE_FIELDS (t); x; x = TREE_CHAIN (x))
if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x)
+ && TREE_TYPE (x) != error_mark_node
&& same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (x)), t))
DECL_MODE (x) = TYPE_MODE (t);
case FUNCTION_DECL:
error ("function %q#D is initialized like a variable", decl);
- initialized = 0;
- break;
+ return error_mark_node;
default:
break;
}
else
error ("variable or field declared void");
- type = integer_type_node;
+ type = error_mark_node;
}
return type;
/* We don't check parameter types here because we can emit a better
error message later. */
if (decl_context != PARM)
- type = check_var_type (unqualified_id, type);
+ {
+ type = check_var_type (unqualified_id, type);
+ if (type == error_mark_node)
+ return error_mark_node;
+ }
/* Now create the decl, which may be a VAR_DECL, a PARM_DECL
or a FUNCTION_DECL, depending on DECL_CONTEXT and TYPE. */
+2006-10-12 Lee Millward <lee.millward@codesourcery.com>
+
+ PR c++/27961
+ * g++.dg/template/crash60.C: New test.
+ * g++.dg/other/large-size-array.C: Adjust error markers.
+ * g++.dg/parse/crash27.C: Likewise.
+ * g++.dg/template/crash1.C: Likewise.
+
2006-10-12 Steve Ellcey <sje@cup.hp.com>
PR testsuite/29093
main (void)
{
int a[DIM][DIM]; /* { dg-error "size of array 'a' is too large" } */
- return sub (&a[0][0]);
+ return sub (&a[0][0]); /* { dg-error "declared" } */
}
/* { dg-error "expected type" "expected 1" { target *-*-* } 4 } */
/* { dg-error "expected `,' before" "expected 2" { target *-*-* } 4 } */
/* { dg-error "expected `\\\)" "expected 3" { target *-*-* } 4 } */
- /* { dg-error "expected ',' or" "expected 4" { target *-*-* } 4 } */
template <class I>
void S::Foo(int (*f)(TYPO&o) ) // { dg-error "Foo|f|TYPO|o" }
-{ // { dg-error "expected `;'" }
+{
}