public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: geb@attbi.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/7202: function arg of "int X(0)" causes seg fault in compiler
Date: Wed, 03 Jul 2002 13:26:00 -0000	[thread overview]
Message-ID: <20020703202756.082FB4F2E@smbear.attbi.com> (raw)


>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:


             reply	other threads:[~2002-07-03 20:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-03 13:26 geb [this message]
2002-07-23  8:36 lerdsuwa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020703202756.082FB4F2E@smbear.attbi.com \
    --to=geb@attbi.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).