Commit 4b41d9eb by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

re PR c++/4494 (Possible problem with compiler warnings on main())

	PR c++/4494
	* decl.c (start_function): Use same_type_p to check return type
	of main.

	* g++.dg/warn/main.C: New test.

From-SVN: r66476
parent 1e77e673
2003-05-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/4494
* decl.c (start_function): Use same_type_p to check return type
of main.
2003-05-03 Zack Weinberg <zack@codesourcery.com> 2003-05-03 Zack Weinberg <zack@codesourcery.com>
PR c/10604 PR c/10604
......
...@@ -13382,8 +13382,9 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags) ...@@ -13382,8 +13382,9 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
ctype = TYPE_METHOD_BASETYPE (fntype); ctype = TYPE_METHOD_BASETYPE (fntype);
else if (DECL_MAIN_P (decl1)) else if (DECL_MAIN_P (decl1))
{ {
/* If this doesn't return integer_type, complain. */ /* If this doesn't return integer_type, or a typedef to
if (TREE_TYPE (TREE_TYPE (decl1)) != integer_type_node) integer_type, complain. */
if (!same_type_p (TREE_TYPE (TREE_TYPE (decl1)), integer_type_node))
{ {
if (pedantic || warn_return_type) if (pedantic || warn_return_type)
pedwarn ("return type for `main' changed to `int'"); pedwarn ("return type for `main' changed to `int'");
......
2003-05-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/4494
* g++.dg/warn/main.C: New test.
2003-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2003-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/nonnull-3.c: New test. * gcc.dg/nonnull-3.c: New test.
......
// { dg-do compile }
// Origin: Donald W. Gillies <dgillies@graviton.com>
// PR c++/4494: Incorrect diagnostics about return type of main.
typedef int int_t;
int_t main() {
}
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