Path: utzoo!telly!philmtl!uunet!cimshop!davidm From: cimshop!davidm@uunet.UU.NET (David S. Masterson) Newsgroups: gnu.g++.bug Subject: Is this a G++ bug? Message-ID: Date: 11 Jan 90 23:59:27 GMT Sender: davidm@cimshop.UUCP Distribution: gnu Organization: Consilium Inc., Mountain View, California. Lines: 43 Below is a short program that exploits what I think is a bug in the G++ compiler. I am using g++ 1.36.1 on SunOS 3.5. The bug calls a method that requires an (alpha*) when a (void*) is passed to it. I would have thought that the compiler should flag this as a function call for which an invalid argument type was passed. Am I wrong? --------Code begins-------- #include class alpha { static int x = 0; public: alpha() { x = x + 1; } ~alpha() {} void print(alpha*); }; void alpha::print(alpha* n) { cout << "X = " << x << " "; if (n != 0) n->print((void*) 0); cout << ";"; } int main(int argc, char *argv[]) { alpha test1; test1.print((void*) 0); alpha *test2 = new alpha; test1.print(test2); cout << "\n"; } -- =================================================================== David Masterson Consilium, Inc. uunet!cimshop!davidm Mt. View, CA 94043 =================================================================== "If someone thinks they know what I said, then I didn't say it!"