OSDN Git Service

2005-10-28 Andrew Pinski <pinskia@physics.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / cp / decl.c
index 8958850..7e38ec3 100644 (file)
@@ -3640,14 +3640,12 @@ start_decl (const cp_declarator *declarator,
 
   deprecated_state = DEPRECATED_NORMAL;
 
-  if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE)
+  if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE
+      || decl == error_mark_node)
     return error_mark_node;
 
   type = TREE_TYPE (decl);
 
-  if (type == error_mark_node)
-    return error_mark_node;
-
   context = DECL_CONTEXT (decl);
 
   if (context)
@@ -5718,8 +5716,12 @@ grokfndecl (tree ctype,
       if (!same_type_p (TREE_TYPE (TREE_TYPE (decl)),
                        integer_type_node))
        {
+         tree oldtypeargs = TYPE_ARG_TYPES (TREE_TYPE (decl));
+         tree newtype;
          error ("%<::main%> must return %<int%>");
-         TREE_TYPE (TREE_TYPE (decl)) = integer_type_node;
+         newtype =  build_function_type (integer_type_node,
+                                         oldtypeargs);
+         TREE_TYPE (decl) = newtype;
        }
       inlinep = 0;
       publicp = 1;
@@ -7570,7 +7572,7 @@ grokdeclarator (const cp_declarator *declarator,
        }
 
       if (ctype == current_class_type)
-       pedwarn ("extra qualification %<%T::%> on member %qs ignored",
+       pedwarn ("extra qualification %<%T::%> on member %qs",
                 ctype, name);
       else if (TREE_CODE (type) == FUNCTION_TYPE)
        {