Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!brunix!sdm From: sdm@cs.brown.edu (Scott Meyers) Newsgroups: comp.lang.c++ Subject: Class-specific operator new Message-ID: <22944@brunix.UUCP> Date: 14 Dec 89 23:09:20 GMT Sender: news@brunix.UUCP Reply-To: sdm@cs.brown.edu (Scott Meyers) Organization: Brown University Department of Computer Science Lines: 31 I think I've found a bug in CC's handling of class-specific definitions of operator new. The following compiles: #include void *operator new(size_t size, void *location){ return location; } class C { char storage[10]; public: C() { new (storage) int; } }; But if I move the definiton of operator new inside the class, it won't compile: #include class C { char storage[10]; public: void *operator new(size_t size, void *location){ return location; } C() { new (storage) int; } }; The error is: error: argument 2 of type void * expected for C::operator new Bona fide bug, or pilot error? Scott sdm@cs.brown.edu