public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24046] New: Inheriting from a base class with private scoped operator new/delete pair
@ 2005-09-23 22:01 richy at fatkid dot org
  2005-09-23 22:02 ` [Bug c++/24046] " richy at fatkid dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: richy at fatkid dot org @ 2005-09-23 22:01 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug c++/24046] Inheriting from a base class with private scoped operator new/delete pair
  2005-09-23 22:01 [Bug c++/24046] New: Inheriting from a base class with private scoped operator new/delete pair richy at fatkid dot org
@ 2005-09-23 22:02 ` richy at fatkid dot org
  2005-09-23 22:05 ` richy at fatkid dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: richy at fatkid dot org @ 2005-09-23 22:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From richy at fatkid dot org  2005-09-23 22:02 -------
Created an attachment (id=9797)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9797&action=view)
baseopdelete.ii


-- 


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


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

* [Bug c++/24046] Inheriting from a base class with private scoped operator new/delete pair
  2005-09-23 22:01 [Bug c++/24046] New: Inheriting from a base class with private scoped operator new/delete pair richy at fatkid dot org
  2005-09-23 22:02 ` [Bug c++/24046] " richy at fatkid dot org
  2005-09-23 22:05 ` 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
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-23 22:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-23 22:05 -------
Yes 2.95.3 is 4 years old and have not been maintined for about 4 years now.
This was fixed in 3.0 which also stoped being maintained for 3 years.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |rejects-valid
      Known to fail|                            |2.95.3
      Known to work|                            |3.0.4 3.3.3 3.4.0 4.0.0
                   |                            |4.1.0
         Resolution|                            |FIXED
   Target Milestone|---                         |3.0.x


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


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

* [Bug c++/24046] Inheriting from a base class with private scoped operator new/delete pair
  2005-09-23 22:01 [Bug c++/24046] New: Inheriting from a base class with private scoped operator new/delete pair richy at fatkid dot org
                   ` (2 preceding siblings ...)
  2005-09-23 22:05 ` pinskia at gcc dot gnu dot org
@ 2005-09-23 22:05 ` richy at fatkid dot org
  3 siblings, 0 replies; 5+ messages in thread
From: richy at fatkid dot org @ 2005-09-23 22:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From richy at fatkid dot org  2005-09-23 22:03 -------
% gcc -v
Reading specs from
/opt/third-party/depot/Linux-2.4c2.2-i686/gcc-2.95.3/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
gcc version 2.95.3 20010315 (release)


-- 


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


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

* [Bug c++/24046] Inheriting from a base class with private scoped operator new/delete pair
  2005-09-23 22:01 [Bug c++/24046] New: Inheriting from a base class with private scoped operator new/delete pair richy at fatkid dot org
  2005-09-23 22:02 ` [Bug c++/24046] " richy at fatkid dot org
@ 2005-09-23 22:05 ` 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
  3 siblings, 0 replies; 5+ messages in thread
From: richy at fatkid dot org @ 2005-09-23 22:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From richy at fatkid dot org  2005-09-23 22:04 -------
Created an attachment (id=9798)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9798&action=view)
baseopdelete.cpp


-- 


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


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

end of thread, other threads:[~2005-09-23 22:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-23 22:01 [Bug c++/24046] New: Inheriting from a base class with private scoped operator new/delete pair richy at fatkid dot org
2005-09-23 22:02 ` [Bug c++/24046] " richy at fatkid dot org
2005-09-23 22:05 ` 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

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