public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21336] New: Internal compiler error when using custom new operators
@ 2005-05-02 12:03 moudekotte at khaeon dot nl
  2005-05-02 12:07 ` [Bug c++/21336] " moudekotte at khaeon dot nl
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: moudekotte at khaeon dot nl @ 2005-05-02 12:03 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2005-06-03 16:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-02 12:03 [Bug c++/21336] New: Internal compiler error when using custom new operators moudekotte at khaeon dot nl
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

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