Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!labrea!mcnc!rti!xyzzy!bert!coleman From: coleman@bert.dg.com (Kim Coleman) Newsgroups: gnu.g++.bug Subject: g++ 1.34.1 bug Summary: func call default parameters Keywords: default parameters Message-ID: <4769@xyzzy.UUCP> Date: 3 Apr 89 21:57:33 GMT Sender: usenet@xyzzy.UUCP Reply-To: coleman@bert.dg.com (Kim Coleman) Distribution: gnu Organization: Data General Corporation, Research Triangle Park, NC. Lines: 40 // Bug with function call parameters in g++ 1.34.1 // // Declaring a class method with a function call default parameter seems to // cause subsequent confusion when compiling the completion of the method. // In the program below, the compiler will hang if there are errors in the // body of annoying::problem. I've hung it with syntax errors, semantic // errors, and warnings (in particular, assignment of a constant pointer to // a non-constant pointer). Related error messages are not printed out. // Only a default parameter value that is a function call seems to provoke // this behavior. As long as you write perfect programs, all is well! :-) // // Older revs of the compiler (pre-1.34) hung up whether or not there were // errors (or even statements) in the function body. // int foo(); class annoying { public: void problem( int position = foo() ); }; void annoying::problem( int position ) { int i; i = unknown; // will cause compiler to hang i=; // so will this int* p; const int* cp; p = cp; // and this } ---------------------- Kim Coleman Data General Corp., Research Triangle Park, NC {the world}!mcnc!rti!dg-rtp!coleman