public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "richy at fatkid dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/24046] New: Inheriting from a base class with private scoped operator new/delete pair Date: Fri, 23 Sep 2005 22:01:00 -0000 [thread overview] Message-ID: <20050923220123.24046.richy@fatkid.org> (raw) There is a gcc 2.95.3 compiler bug where inheriting from a base class with a private 'operator delete' (and its matching partner 'operator new') complains and bails. Privitizing class specific operator new/delete pair is a common idom to prevent freestore allocation. This is fixed in later version of gcc. 1 #include <sys/types.h> 2 3 class Base 4 { 5 public: 6 Base() {} 7 ~Base() {} 8 private: 9 // Prevent allocation on freestore -- privitize op new/delete 10 static void* operator new (size_t size); 11 static void operator delete(void*); 12 }; 13 14 class Derived : public Base 15 { 16 public: 17 Derived() {} 18 ~Derived() {} 19 }; % gcc -save-temps -Wall baseopdelete.cpp baseopdelete.cpp: In method `Derived::~Derived()': baseopdelete.cpp:11: `static void Base::operator delete(void *)' is private baseopdelete.cpp:18: within this context -- Summary: Inheriting from a base class with private scoped operator new/delete pair Product: gcc Version: 2.95.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: richy at fatkid dot org CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: Linux 2.4.29 GCC target triplet: 2.95.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24046
next reply other threads:[~2005-09-23 22:01 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-09-23 22:01 richy at fatkid dot org [this message] 2005-09-23 22:02 ` [Bug c++/24046] " richy at fatkid dot org 2005-09-23 22:05 ` pinskia at gcc dot gnu dot org 2005-09-23 22:05 ` richy at fatkid dot org 2005-09-23 22:05 ` richy at fatkid 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=20050923220123.24046.richy@fatkid.org \ --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: linkBe 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).