[llvm-bugs] [Bug 28595] New: some elements of the free array captured in lambda expression can't be destructed when exception happens

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 18 01:24:02 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28595

            Bug ID: 28595
           Summary: some elements of the free array captured in lambda
                    expression can't be destructed when exception happens
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: westion717 at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

int ctor=0;
int dtor=0;
struct A{
    A(){}
    A(const A& a){if(ctor==3) throw -1;ctor++;}
    ~A(){dtor++;}
};

#include <cstdio>
int main(){
    A a[5];

    try{
    [a](){}();
    }catch(...)
    {
    }
    printf("ctor:%d\n",ctor);
    printf("dtor:%d\n",dtor);
    return 0;
}

/*
expected:

ctor:3
dtor:3
*/

/*
actual:

ctor:3
dtor:0
*/

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160718/71675e3f/attachment.html>


More information about the llvm-bugs mailing list