aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>2003-05-05 12:19:12 +0000
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>2003-05-05 12:19:12 +0000
commit4b41d9ebe1de8df643178c2526e6ebd04ad7280a (patch)
treef60d3ff551a0b0872e8682bfb14e152b62836009 /gcc/cp/decl.c
parent1e77e67301dfb36ff74a274a100489d6cce714b8 (diff)
downloadgcc-4b41d9ebe1de8df643178c2526e6ebd04ad7280a.zip
gcc-4b41d9ebe1de8df643178c2526e6ebd04ad7280a.tar.gz
gcc-4b41d9ebe1de8df643178c2526e6ebd04ad7280a.tar.bz2
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
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6cbcd3f..34f82bd 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -13382,8 +13382,9 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
ctype = TYPE_METHOD_BASETYPE (fntype);
else if (DECL_MAIN_P (decl1))
{
- /* If this doesn't return integer_type, complain. */
- if (TREE_TYPE (TREE_TYPE (decl1)) != integer_type_node)
+ /* If this doesn't return integer_type, or a typedef to
+ integer_type, complain. */
+ if (!same_type_p (TREE_TYPE (TREE_TYPE (decl1)), integer_type_node))
{
if (pedantic || warn_return_type)
pedwarn ("return type for `main' changed to `int'");