[gnu.g++.bug] G++ ignores static destructors under strange conditions

schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (10/11/88)

Hi,

   Here is a weird program, that prints
   
   hello world
    world

   when compiled and executed with AT&T CC 1.2.1.  G++ 1.27 prints only
   
   hello

   This appears to be an error, but I'm not certain enough of the semantics
of destructors to know for certain.  

   Here's the code:

----------------------------------------      
struct Main {
public:
   Main ( void ) {
      printf ( "hello " );
      exit();
   }   
   ~Main ( void ) {
      printf ( "world\n" );
   }
};

static struct Main Initialization_Code;

main() {
   printf ( "my " );
}
----------------------------------------