[LLVMbugs] [Bug 8175] New: Destructors for stack variables not firing on goto from scope

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 17 16:44:26 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8175

           Summary: Destructors for stack variables not firing on goto
                    from scope
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jplevyak at acm.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


#include "stdio.h"

class L {
public:
int i;
L(int j) : i(j) { printf("L(%d)\n", i); }
~L() { if (i != 11) printf("~L(%d)\n", i); }
};

int main(int argc, char *argv[]) {
{ L b(argc) ; printf("goto\n"); if (argc) goto l; }

l:
printf("here\n");
return 5;
}

jplevyak:svn [982] % g++ x.cc ; a.out
L(1)
goto
~L(1)
here

jplevyak:svn [983] % clang++ x.cc ; a.out
L(1)
goto
here

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list