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

           Summary: buggy behaviour when exception is thrown from the
                    constructor
           Product: clang
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


The attached example demonstrates what seems to be a bug in clang when an
exception is thrown from the constructor. Although the behaviour is different
whether the construction/allocation is static or dynamic, it is wrong in both
cases.

Constrast
  $ make CXX=g++ # default
  $ /ctorexcept static 1234
  instances: 0
  $ /ctorexcept dynamic 1234
  instances: 0
with
  $ make CXX=clang++
  $ /ctorexcept static 1234
  instances: 10
  $ /ctorexcept dynamic 1234
  # segmentation fault!
  # according to valgrind it was an "Invalid free() / delete / delete[]"

If the destructor is not defined, which may be achieved compiling with
  $ make CXX_FLAGS=-DISABLE_DTOR
no segmentation fault ocurrs in the dynamic case, making its behaviour seemly
identical to the static case.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to