public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "moudekotte at khaeon dot nl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/21336] New: Internal compiler error when using custom new operators
Date: Mon, 02 May 2005 12:03:00 -0000	[thread overview]
Message-ID: <20050502120304.21336.moudekotte@khaeon.nl> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1795 bytes --]

The following piece of code crashes both my custom built gcc 4.0.0 (straight
from an official mirror) and gcc 4.0.0-0.41.fc3 from Red Hat. The code is a
reconstruction of a piece of propriatary code I cannot post. 

CODE:
typedef unsigned int size_t;

class A;
class B;
class C;

template<class _T> inline void* operator new( size_t Size, _T&);
template<class _T> inline void operator delete( void*, _T&);

class Abase {};
class A : public Abase {
public:
	A() {}
	A(int a, int b, int c, int d) {}
};

class Bbase {};
class B : public Bbase {
public:
	Abase* m() {
		return new(a) A(1,2,3,4);
	}
	A a;
};

class C {
public:
	Bbase* n() {
		return new B();
	}
};

GCC OUTPUT:
main.cpp: In member function ‘Bbase* C::n()’:
main.cpp:29: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccUR3mvM.out file, please attach this to
your bugreport.

OTHER COMPILERS:
MSVC++ 7.0 compiles the code above without warnings.

gcc version 3.4.3 20050227 (Red Hat 3.4.3-22.fc3) returns this:
main.cpp: In member function `Bbase* C::n()':
main.cpp:29: error: no suitable or ambiguous `operator new' found in class `B'

-- 
           Summary: Internal compiler error when using custom new operators
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: moudekotte at khaeon dot nl
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-redhat-linux
GCC target triplet: i386-redhat-linux


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


             reply	other threads:[~2005-05-02 12:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-02 12:03 moudekotte at khaeon dot nl [this message]
2005-05-02 12:07 ` [Bug c++/21336] " moudekotte at khaeon dot nl
2005-05-02 12:22 ` [Bug c++/21336] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-05-19 17:40 ` mmitchel at gcc dot gnu dot org
2005-06-01  0:17 ` pinskia at gcc dot gnu dot org
2005-06-02 17:49 ` mmitchel at gcc dot gnu dot org
2005-06-03 16:17 ` cvs-commit at gcc dot gnu dot org
2005-06-03 16:19 ` cvs-commit at gcc dot gnu dot org
2005-06-03 16:19 ` [Bug c++/21336] [3.4 " mmitchel at gcc dot gnu dot org
2005-06-03 16:29 ` cvs-commit at gcc dot gnu dot org
2005-06-03 16:31 ` mmitchel at gcc dot gnu dot org

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=20050502120304.21336.moudekotte@khaeon.nl \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).