aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2005-10-28 20:25:55 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2005-10-28 13:25:55 -0700
commit9a1c562a7dffed364bd5213c9848a00478999506 (patch)
treeac86dcbd6e63260aa752f6f51f4d938c9c43f36f /gcc/cp
parent7dcd894f70f356bbc80abf90157ec70b9b85de9d (diff)
downloadgcc-9a1c562a7dffed364bd5213c9848a00478999506.zip
gcc-9a1c562a7dffed364bd5213c9848a00478999506.tar.gz
gcc-9a1c562a7dffed364bd5213c9848a00478999506.tar.bz2
re PR c++/23229 (g++ gives incorrect error message with void main() and a void function)
2005-10-28 Andrew Pinski <pinskia@physics.uc.edu> PR C++/23229 * decl.c (grokfndecl): Create a new function type after erroring out about main not returning int. 2005-10-28 Andrew Pinski <pinskia@physics.uc.edu> PR C++/23229 * g++.dg/warn/main-2.C: New test. From-SVN: r105960
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fed864d..81da122 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-28 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR C++/23229
+ * decl.c (grokfndecl): Create a new function type
+ after erroring out about main not returning int.
+
2005-10-28 Josh Conner <jconner@apple.com>
PR c++/22153
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index ef61d17..07278ff 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5716,7 +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%>");
+ newtype = build_function_type (integer_type_node,
+ oldtypeargs);
+ TREE_TYPE (decl) = newtype;
TREE_TYPE (TREE_TYPE (decl)) = integer_type_node;
}
inlinep = 0;