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: unassignedclangb...@nondot.org
          Reporter: westion...@gmail.com
                CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to