OSDN Git Service

PR c++/28274
[pf3gnuchains/gcc-fork.git] / gcc / cp / decl.c
index fe73942..0e2a87e 100644 (file)
@@ -1691,6 +1691,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
        check_redeclaration_exception_specification (newdecl, olddecl);
       TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype;
 
+      if (TREE_CODE (newdecl) == FUNCTION_DECL)
+       check_default_args (newdecl);
+
       /* Lay the type out, unless already done.  */
       if (! same_type_p (newtype, oldtype)
          && TREE_TYPE (newdecl) != error_mark_node
@@ -10435,8 +10438,6 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
      you declare a function, these types can be incomplete, but they
      must be complete when you define the function.  */
   check_function_type (decl1, current_function_parms);
-  /* Make sure no default arg is missing.  */
-  check_default_args (decl1);
 
   /* Build the return declaration for the function.  */
   restype = TREE_TYPE (fntype);