Article View: gnu.g++.bug
Article #832cc1plus bug: friends that are destructors
From: Steven McCanne
Date: Thu, 20 Aug 1992 00:13
Date: Thu, 20 Aug 1992 00:13
35 lines
1387 bytes
1387 bytes
cc1plus does not allow destructors to be declared as friends.
It reports an error for the following code fragment:
1 class B {
2 public:
3 ~B();
4 };
5
6 class A {
7 friend B::~B();
8 };
The error is
t.cc:7: class `B' already has destructor defined
The problem is a gratuitous check in grokdeclarator(), in cp-decl.c.
Removing the offending check solves the problem. (A multiply-declared
destructor is detected elsewhere.)
Steve
-----
*** /tmp/,RCSt1a29274 Wed Aug 19 17:00:59 1992
--- cp-decl.c Wed Aug 19 15:56:42 1992
***************
*** 7167,7174 ****
if (! member_function_or_else (ctype, current_class_type,
"destructor for alien class `%s' cannot be a member"))
return NULL_TREE;
- if (TYPE_HAS_DESTRUCTOR (ctype))
- error_with_aggr_type (ctype, "class `%s' already has destructor defined");
}
}
else if (flags == WRAPPER_FLAG || flags == ANTI_WRAPPER_FLAG)
--- 7167,7172 ----
Technical Details
Message-ID:
<9208200013.AA29338@horse.ee.lbl.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!horse.ee.lbl.gov!mccanneShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!horse.ee.lbl.gov!mccanne From: mccanne@horse.ee.lbl.gov (Steven McCanne) Subject: cc1plus bug: friends that are destructors Message-ID: <9208200013.AA29338@horse.ee.lbl.gov> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 20 Aug 1992 00:13:54 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 36