public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23229] New: g++ gives incorrect error message with void main() and a void function
@ 2005-08-04 11:27 pvuorela at iki dot fi
  2005-08-04 13:02 ` [Bug c++/23229] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: pvuorela at iki dot fi @ 2005-08-04 11:27 UTC (permalink / raw)
  To: gcc-bugs

g++ 4.0.1 gives incorrect error message with void function declaration &  
implementation when using void main(). This can be demonstrated with the  
following program:  
  
------  
void f1();  
  
void main()  
{     
   f1();  
}  
  
void f1()  
{     
}  
----  
  
The resulting error message is:  
gccbug.cc:3: error: '::main' must return 'int'  
gccbug.cc: In function 'void f1()':  
gccbug.cc:8: error: new declaration 'void f1()'  
gccbug.cc:1: error: ambiguates old declaration 'int f1()'  
  
Granted, using void for return value of main() is an error, but so is the  
resulting message.   
The error message is correct with gcc 3.3.5 and 3.4.4 (debian prerelease). 
 
  
Since "Reporting bugs" web page requested the environment,  
gcc -v gives:  
Using built-in specs.  
Target: i486-linux-gnu  
Configured with: ../src/configure -v  
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr  
--enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls  
--without-included-gettext --enable-threads=posix --program-suffix=-4.0  
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu  
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk  
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr  
--disable-werror --enable-checking=release i486-linux-gnu  
Thread model: posix  
gcc version 4.0.1 (Debian 4.0.1-2)  
  
system:  
Linux maestro 2.6.12.1 #1 SMP Sun Jun 26 16:24:58 EEST 2005 i686 GNU/Linux

-- 
           Summary: g++ gives incorrect error message with void main() and a
                    void function
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pvuorela at iki dot fi
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23229


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/23229] [4.0/4.1 Regression] g++ gives incorrect error message with void main() and a void function
  2005-08-04 11:27 [Bug c++/23229] New: g++ gives incorrect error message with void main() and a void function pvuorela at iki dot fi
@ 2005-08-04 13:02 ` pinskia at gcc dot gnu dot org
  2005-08-08 18:21 ` pinskia at gcc dot gnu dot org
  2005-09-27 15:59 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-04 13:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-04 13:02 -------
Confirmed, weird.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
 GCC target triplet|i486-linux-gnu              |
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-04 13:02:26
               date|                            |
            Summary|g++ gives incorrect error   |[4.0/4.1 Regression] g++
                   |message with void main() and|gives incorrect error
                   |a void function             |message with void main() and
                   |                            |a void function
   Target Milestone|---                         |4.0.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23229


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/23229] [4.0/4.1 Regression] g++ gives incorrect error message with void main() and a void function
  2005-08-04 11:27 [Bug c++/23229] New: g++ gives incorrect error message with void main() and a void function pvuorela at iki dot fi
  2005-08-04 13:02 ` [Bug c++/23229] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-08-08 18:21 ` pinskia at gcc dot gnu dot org
  2005-09-27 15:59 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-08 18:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-08 18:21 -------
This was introduced between 20040923 and 20040924.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23229


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/23229] [4.0/4.1 Regression] g++ gives incorrect error message with void main() and a void function
  2005-08-04 11:27 [Bug c++/23229] New: g++ gives incorrect error message with void main() and a void function pvuorela at iki dot fi
  2005-08-04 13:02 ` [Bug c++/23229] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-08-08 18:21 ` pinskia at gcc dot gnu dot org
@ 2005-09-27 15:59 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 15:59 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23229


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/23229] [4.0/4.1 Regression] g++ gives incorrect error message with void main() and a void function
       [not found] <bug-23229-11115@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2005-10-28 20:52 ` pinskia at gcc dot gnu dot org
@ 2005-10-28 21:02 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-28 21:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2005-10-28 21:02 -------
Fixed in 4.0.3.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23229


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/23229] [4.0/4.1 Regression] g++ gives incorrect error message with void main() and a void function
       [not found] <bug-23229-11115@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-10-28 20:26 ` pinskia at gcc dot gnu dot org
@ 2005-10-28 20:52 ` pinskia at gcc dot gnu dot org
  2005-10-28 21:02 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-28 20:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2005-10-28 20:52 -------
Subject: Bug 23229

Author: pinskia
Date: Fri Oct 28 20:52:44 2005
New Revision: 105961

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=105961
Log:
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.


Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/warn/main-2.C
      - copied unchanged from r105960, trunk/gcc/testsuite/g++.dg/warn/main-2.C
Modified:
    branches/gcc-4_0-branch/gcc/cp/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/decl.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23229


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/23229] [4.0/4.1 Regression] g++ gives incorrect error message with void main() and a void function
       [not found] <bug-23229-11115@http.gcc.gnu.org/bugzilla/>
  2005-10-27 14:11 ` pinskia at gcc dot gnu dot org
  2005-10-27 19:21 ` pinskia at gcc dot gnu dot org
@ 2005-10-28 20:26 ` pinskia at gcc dot gnu dot org
  2005-10-28 20:52 ` pinskia at gcc dot gnu dot org
  2005-10-28 21:02 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-28 20:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2005-10-28 20:26 -------
Subject: Bug 23229

Author: pinskia
Date: Fri Oct 28 20:25:55 2005
New Revision: 105960

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=105960
Log:
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.


Added:
    trunk/gcc/testsuite/g++.dg/warn/main-2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23229


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/23229] [4.0/4.1 Regression] g++ gives incorrect error message with void main() and a void function
       [not found] <bug-23229-11115@http.gcc.gnu.org/bugzilla/>
  2005-10-27 14:11 ` pinskia at gcc dot gnu dot org
@ 2005-10-27 19:21 ` pinskia at gcc dot gnu dot org
  2005-10-28 20:26 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-27 19:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2005-10-27 19:21 -------
Patch posted: <http://gcc.gnu.org/ml/gcc-patches/2005-10/msg01582.html>.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |10/msg01582.html
           Keywords|                            |patch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23229


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/23229] [4.0/4.1 Regression] g++ gives incorrect error message with void main() and a void function
       [not found] <bug-23229-11115@http.gcc.gnu.org/bugzilla/>
@ 2005-10-27 14:11 ` pinskia at gcc dot gnu dot org
  2005-10-27 19:21 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-27 14:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-10-27 14:11 -------
I have a simple fix for this, we just need to copy the type as it looks as it
is shared now.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23229


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-10-28 21:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-04 11:27 [Bug c++/23229] New: g++ gives incorrect error message with void main() and a void function pvuorela at iki dot fi
2005-08-04 13:02 ` [Bug c++/23229] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-08-08 18:21 ` pinskia at gcc dot gnu dot org
2005-09-27 15:59 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-23229-11115@http.gcc.gnu.org/bugzilla/>
2005-10-27 14:11 ` pinskia at gcc dot gnu dot org
2005-10-27 19:21 ` pinskia at gcc dot gnu dot org
2005-10-28 20:26 ` pinskia at gcc dot gnu dot org
2005-10-28 20:52 ` pinskia at gcc dot gnu dot org
2005-10-28 21:02 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).