This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++ 2.95.2: goto+dtor bug


Here is a program where destructor is not run at all. No warning is produced
either. Test system: gcc-2.95.2, linux, glibc-2.1.2.

#include <stdio.h>
class a
{
public:
   a()  { printf("ctor\n"); }
   ~a() { printf("dtor\n"); }
};
int main(int argc,char **argv)
{
   if(argc>1)
   {
   leave:
      return 0;
   }
   a var;
   goto leave;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]