This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
default constructor replaces explicit definition
- To: egcs-bugs at cygnus dot com
- Subject: default constructor replaces explicit definition
- From: Chris Jang <cjang at ix dot netcom dot com>
- Date: Sat, 30 Jan 1999 14:23:14 -0600 (CST)
- Reply-To: Chris Jang <cjang at ix dot netcom dot com>
Hello egcs-bugs,
First, thanks for all of the work. It is appreciated very much. I'm using
egcs-1.1b on what was originally a K6 based RedHat 4.2 system but since
has been upgraded substantially as regards kernel and libraries.
The code below shows the problem. Depending on how the stack instance of a
MyUndefinedClass is declared, the user defined default constructor may be
optimized away in favor of one generated by the compiler.
If someone else has sent this in, sorry for the bother.
Thanks,
Chris Jang
#include <iostream.h>
class MyUndefinedClass
{
public:
MyUndefinedClass() { cout << "electro vlassic" << endl << flush; }
};
int
main(int argc, char **argv)
{
#if 0
// nothing is printed to standard out
MyUndefinedClass bad();
#else
// "electro vlassic" is printed to standard out
MyUndefinedClass good;
#endif
return 0;
}