[LLVMbugs] [Bug 6756] New: exception object not destructed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 1 10:09:58 PDT 2010


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

           Summary: exception object not destructed
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hhinnant at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


This test should pass:

#include <stdio.h>
#include <assert.h>

struct A
{
  static int constructed;
  int data_;

  explicit A(int data = 0) : data_(data)
  {
      ++constructed;
  }

  ~A()
  {
      --constructed;
  }

  A(const A& a)
      : data_(a.data_)
  {
      ++constructed;
  }

private:

  A& operator=(const A&);
};

int A::constructed = 0;


int main()
{
  try
  {
      throw A(5);
      assert(false);
  }
  catch (A& a)
  {
      assert(a.data_ == 5);
      assert(A::constructed == 1);
  }
  printf("J: %d\n", A::constructed);
  assert(A::constructed == 0);
}

-- 
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