Article View: gnu.g++.bug
Article #899Possible bug with overloading operator new in gcc 2.2.1
From: Lewis G. Pringle
Date: Thu, 03 Sep 1992 20:26
Date: Thu, 03 Sep 1992 20:26
26 lines
1611 bytes
1611 bytes
// Compiling this file with gcc 2.2.1:
// as follows: g++ -c g.cc
// produces the messages:
// g.cc: In method `ArrayNode::ArrayNode (int)':
// g.cc:20: too few arguments for method `operator new'
//
// I can almost believe this is right, since I have overloaded
// operator new here so that the obvious call that might be generated
// silently in the CTOR would not match. However, that it supposed
// to be an implementation detail of the compiler, and should not
// show thru. In fact, you should generate a call to the two argument
// version - I think. In this particular instance, I have no intention
// of ever allocating any of these nodes on the free store anyhow, and
// so its silly that I should have to overload new here additionally
// to take one arg, just so that can get stuck into my CTOR code.
// BTW, this compiles fine with CFront 2.1.
typedef unsigned size_t;
class ArrayNode {
public:
ArrayNode (int item): fItem (item){} // I am line 20
~ArrayNode (){}
int fItem;
static void* operator new (size_t, void* p) { return (p); }
static void operator delete (void*) {}
};
Technical Details
Message-ID:
<m0mQNku-000AWzC@sophists.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!wupost!usc!sdd.hp.com!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sophists.COM!lewisShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!usc!sdd.hp.com!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sophists.COM!lewis From: lewis@sophists.COM (Lewis G. Pringle) Newsgroups: gnu.g++.bug Subject: Possible bug with overloading operator new in gcc 2.2.1 Message-ID: <m0mQNku-000AWzC@sophists.com> Date: 3 Sep 92 20:26:00 GMT Sender: gnulists@ai.mit.edu Reply-To: lewis@sophists.com Distribution: gnu Organization: GNUs Not Usenet Lines: 26 Approved: bug-g++@prep.ai.mit.edu