if (same_type_p (TREE_TYPE (f1), TREE_TYPE (f2)))
{
- if (p2 == NULL_TREE && DECL_EXTERN_C_P (olddecl)
+ if (!prototype_p (f2) && DECL_EXTERN_C_P (olddecl)
&& (DECL_BUILT_IN (olddecl)
#ifndef NO_IMPLICIT_EXTERN_C
|| (DECL_IN_SYSTEM_HEADER (newdecl) && !DECL_CLASS_SCOPE_P (newdecl))
TREE_TYPE (newdecl) = TREE_TYPE (olddecl);
}
#ifndef NO_IMPLICIT_EXTERN_C
- else if (p1 == NULL_TREE
+ else if (!prototype_p (f1)
&& (DECL_EXTERN_C_P (olddecl)
&& DECL_IN_SYSTEM_HEADER (olddecl)
&& !DECL_CLASS_SCOPE_P (olddecl))
}
#endif
else
- types_match = compparms (p1, p2);
+ types_match =
+ compparms (p1, p2)
+ && (TYPE_ATTRIBUTES (TREE_TYPE (newdecl)) == NULL_TREE
+ || targetm.comp_type_attributes (TREE_TYPE (newdecl),
+ TREE_TYPE (olddecl)) != 0);
}
else
types_match = 0;
}
else if (TREE_CODE (olddecl) == FUNCTION_DECL
&& DECL_INITIAL (olddecl) != NULL_TREE
- && TYPE_ARG_TYPES (TREE_TYPE (olddecl)) == NULL_TREE
- && TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != NULL_TREE)
+ && !prototype_p (TREE_TYPE (olddecl))
+ && prototype_p (TREE_TYPE (newdecl)))
{
/* Prototype decl follows defn w/o prototype. */
warning_at (input_location, 0, "prototype for %q+#D", newdecl);
error ("const %qs cannot be declared %<mutable%>", name);
storage_class = sc_none;
}
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ {
+ permerror (input_location, "reference %qs cannot be declared "
+ "%<mutable%>", name);
+ storage_class = sc_none;
+ }
}
/* If this is declaring a typedef name, return a TYPE_DECL. */
if (thread_p)
DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+
+ if (constexpr_p && !initialized)
+ {
+ error ("constexpr static data member %qD must have an "
+ "initializer", decl);
+ constexpr_p = false;
+ }
}
else
{