Commit 9a1c562a by Andrew Pinski Committed by Andrew Pinski

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
parent 7dcd894f
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
......
......@@ -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;
......
2005-10-28 Andrew Pinski <pinskia@physics.uc.edu>
PR C++/23229
* g++.dg/warn/main-2.C: New test.
2005-10-28 Steven G. Kargl <kargls@comcast.net>
PR fortran/24545
// { dg-do compile }
// Make sure that the type of f1 does not change
// after the error of main about not returning
// int.
// From Pekka Vuorela <pvuorela@iki.fi>
// PR c++/23229
void f1();
void
main() /* { dg-error "must return" } */
{
f1();
}
void f1()
{
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment