| Summary: | [3.4 Regression] Internal compiler error when using custom new operators | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Marc 'Foddex' Oude Kotte <moudekotte> |
| Component: | c++ | Assignee: | Mark Mitchell <mark> |
| Status: | RESOLVED FIXED | ||
| Severity: | critical | CC: | gcc-bugs |
| Priority: | P2 | Keywords: | ice-on-valid-code |
| Version: | 4.0.0 | ||
| Target Milestone: | 3.4.5 | ||
| Host: | Target: | ||
| Build: | Known to work: | 3.3.3 | |
| Known to fail: | 3.4.0 4.0.0 4.1.0 | Last reconfirmed: | 2005-05-02 12:21:41 |
| Attachments: | Preprocessed file | ||
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'