@@ -2957,6 +2957,17 @@ duplicate_decls (tree newdecl, tree olddecl)
{
/* Avoid `unused variable' and other warnings for OLDDECL. */
suppress_warning (olddecl, OPT_Wunused);
+ /* If the types are completely different, poison them both with
+ error_mark_node. */
+ if (TREE_CODE (TREE_TYPE (newdecl)) != TREE_CODE (TREE_TYPE (olddecl))
+ && olddecl != error_mark_node
+ && seen_error())
+ {
+ if (TREE_CODE (olddecl) != FUNCTION_DECL)
+ TREE_TYPE (olddecl) = error_mark_node;
+ if (TREE_CODE (newdecl) != FUNCTION_DECL)
+ TREE_TYPE (newdecl) = error_mark_node;
+ }
return false;
}
@@ -12209,7 +12220,7 @@ free_attr_access_data ()
attr_access::free_lang_data (attrs);
tree fntype = TREE_TYPE (n->decl);
- if (!fntype)
+ if (!fntype || fntype == error_mark_node)
continue;
tree attrs = TYPE_ATTRIBUTES (fntype);
if (!attrs)
@@ -4,12 +4,13 @@
int f (void)
{
extern float v;
-
+/* { dg-message "note: previous declaration" "previous declaration" { target *-*-* } .-1 } */
return (v > 0.0f);
}
extern int t;
+/* { dg-message "note: previous declaration" "previous declaration" { target *-*-* } .-1 } */
typedef float t; /* { dg-error "redeclared as different kind of symbol" } */
-t v = 4.5f;
+t v = 4.5f; /* { dg-error "conflicting types" } */