This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/1969: private delete fails mysteriously
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/1969: private delete fails mysteriously
- From: bh at techhouse dot org
- Date: 14 Feb 2001 00:05:00 -0000
- Reply-To: bh at techhouse dot org
>Number: 1969
>Category: c++
>Synopsis: private delete fails mysteriously
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Feb 13 16:06:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Benoit Hudson
>Release: gcc version 2.97 20010212 (experimental)
>Organization:
>Environment:
>Description:
I found this on gcc-2.95.2 but it's still present on the
CodeSourcery version.
>How-To-Repeat:
cat > foo.cc << EOF
class A {
private:
void operator delete(void*);
public:
virtual ~A() { }
};
class B : public A {
public:
virtual ~B() { }
};
EOF
gcc -c foo.cc
>Fix:
Make delete be accessible to B (protected, for instance).
Never destroy a B.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="foo.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="foo.cc"
Y2xhc3MgQSB7CiAgICBwcml2YXRlOgogICAgICAgIHZvaWQgb3BlcmF0b3IgZGVsZXRlKHZvaWQq
KTsKICAgIHB1YmxpYzoKICAgICAgICB2aXJ0dWFsIH5BKCkgeyB9Cn07CgpjbGFzcyBCIDogcHVi
bGljIEEgewogICAgcHVibGljOgogICAgICAgIHZpcnR1YWwgfkIoKSB7IH0KfTsK