public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7202: function arg of "int X(0)" causes seg fault in compiler
@ 2002-07-03 13:26 geb
  0 siblings, 0 replies; 2+ messages in thread
From: geb @ 2002-07-03 13:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7202
>Category:       c++
>Synopsis:       function arg of "int X(0)" causes seg fault in compiler
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 03 13:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Gary Barnes
>Release:        3.0.1
>Organization:
none
>Environment:
System: Linux smbear.attbi.com 2.4.3-20mdk #1 Sun Apr 15 23:03:10 CEST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --prefix=/usr/local
>Description:
Using g++ command, immediate internal error, segmentation fault.
Appears to be due to use of constructor for default value of function argument.
>How-To-Repeat:
This command line:

g++ -c foo.cc -o foo.o -g  -MMD -frepo -ansi -pedantic -fshort-enums -W -Wall \
-Wundef -Wshadow -Wpointer_arith -Wbad-function-cast -Wcast-qual -Wcast-align \
-Wwrite-strings -Wconversion -Wsign-compare -Wredundant-decls \
-Wunreachable-code -Wmissing-declarations -Winline -fmessage-length=99999 \
-Werror

This is the source code in foo.cc:

template <class Arg>
class One {
public:
    virtual int Func (int X (0));
};

template <class Arg>
int One <Arg>::Func (int X (0)) {
    return 1;
}


>Fix:
Use
    int X = int (0) 
instead.  I discovered this using a more complicated type of course, one that
had a nontrivial constructor, but the bug shows with int.


>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/7202: function arg of "int X(0)" causes seg fault in compiler
@ 2002-07-23  8:36 lerdsuwa
  0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2002-07-23  8:36 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, geb, nobody

Synopsis: function arg of "int X(0)" causes seg fault in compiler

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Tue Jul 23 08:36:09 2002
State-Changed-Why:
    GCC 3.1 no longer ICE.  The code is illegal and
     int X=0 or int X=int(0)
    should be used instead.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7202


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

end of thread, other threads:[~2002-07-23 15:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-03 13:26 c++/7202: function arg of "int X(0)" causes seg fault in compiler geb
2002-07-23  8:36 lerdsuwa

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).