OSDN Git Service

* decl.c (grokfndecl): Require that `main' return an `int'.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 Aug 2000 07:28:36 +0000 (07:28 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 Aug 2000 07:28:36 +0000 (07:28 +0000)
* mangle.c (write_encoding): Don't mangle return types for
conversion functions.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35972 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/mangle.c
gcc/testsuite/g++.old-deja/g++.other/main2.C [new file with mode: 0644]

index d0d7e0d..35612d8 100644 (file)
@@ -1,3 +1,9 @@
+2000-08-25  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (grokfndecl): Require that `main' return an `int'.
+       * mangle.c (write_encoding): Don't mangle return types for
+       conversion functions.
+
 2000-08-25  Gabriel Dos Reis  <gdr@codesourcery.com>
 
        * error.c (tree_formatting_info): New data type.
index f035f2f..613c44e 100644 (file)
@@ -8819,8 +8819,11 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
        error ("cannot declare `::main' to be a template");
       if (inlinep)
        error ("cannot declare `::main' to be inline");
-      else if (! publicp)
+      if (!publicp)
        error ("cannot declare `::main' to be static");
+      if (!same_type_p (TREE_TYPE (TREE_TYPE (decl)),
+                       integer_type_node))
+       error ("`main' must return `int'");
       inlinep = 0;
       publicp = 1;
     }
index 9ca7178..0747ebc 100644 (file)
@@ -643,6 +643,7 @@ write_encoding (decl)
       write_bare_function_type (fn_type, 
                                (!DECL_CONSTRUCTOR_P (decl)
                                 && !DECL_DESTRUCTOR_P (decl)
+                                && !DECL_CONV_FN_P (decl)
                                 && decl_is_template_id (decl, NULL)));
     }
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.other/main2.C b/gcc/testsuite/g++.old-deja/g++.other/main2.C
new file mode 100644 (file)
index 0000000..ea4870f
--- /dev/null
@@ -0,0 +1,4 @@
+// Build don't link:
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+double main () {} // ERROR - main must return `int'