- && DECL_ARTIFICIAL (olddecl)
- && (DECL_BUILT_IN (olddecl) || DECL_BUILT_IN_NONANSI (olddecl)))
- {
- /* If you declare a built-in or predefined function name as static,
- the old definition is overridden, but optionally warn this was a
- bad choice of name. Ditto for overloads. */
- if (! TREE_PUBLIC (newdecl)
- || (TREE_CODE (newdecl) == FUNCTION_DECL
- && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl)))
- {
- if (warn_shadow)
- cp_warning ("shadowing %s function `%#D'",
- DECL_BUILT_IN (olddecl) ? "built-in" : "library",
+ && DECL_ARTIFICIAL (olddecl))
+ {
+ if (TREE_CODE (newdecl) != FUNCTION_DECL)
+ {
+ /* If you declare a built-in or predefined function name as static,
+ the old definition is overridden, but optionally warn this was a
+ bad choice of name. */
+ if (! TREE_PUBLIC (newdecl))
+ {
+ if (warn_shadow)
+ cp_warning ("shadowing %s function `%#D'",
+ DECL_BUILT_IN (olddecl) ? "built-in" : "library",
+ olddecl);
+ /* Discard the old built-in function. */
+ return 0;
+ }
+ /* If the built-in is not ansi, then programs can override
+ it even globally without an error. */
+ else if (! DECL_BUILT_IN (olddecl))
+ cp_warning ("library function `%#D' redeclared as non-function `%#D'",
+ olddecl, newdecl);
+ else
+ {
+ cp_error ("declaration of `%#D'", newdecl);
+ cp_error ("conflicts with built-in declaration `%#D'",