From: Mark Mitchell Date: Fri, 25 Aug 2000 07:28:36 +0000 (+0000) Subject: decl.c (grokfndecl): Require that `main' return an `int'. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f22967f31a37794d2c0cd754c7ec2437530217d2;p=gcc.git decl.c (grokfndecl): Require that `main' return an `int'. * decl.c (grokfndecl): Require that `main' return an `int'. * mangle.c (write_encoding): Don't mangle return types for conversion functions. From-SVN: r35972 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d0d7e0dee49..35612d8396b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2000-08-25 Mark Mitchell + + * 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 * error.c (tree_formatting_info): New data type. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f035f2f980a..613c44e9a0c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; } diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 9ca7178e08f..0747ebcbf34 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -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 index 00000000000..ea4870f7a58 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/main2.C @@ -0,0 +1,4 @@ +// Build don't link: +// Origin: Mark Mitchell + +double main () {} // ERROR - main must return `int'