https://bugs.llvm.org/show_bug.cgi?id=40363
Bug ID: 40363
Summary: Test failure: constructor and deconstructor called
unequal number of times
Product: clang
Version: trunk
Hardware: Other
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: stef...@ca.ibm.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
The following passed but now fails:
// -- test.cpp --
int ctor = 0;
int dtor = 0;
struct A {
A() { ctor++; }
~A() { dtor++; }
A(const A&) { ctor++; }
};
int main()
{
ctor = dtor = 0;
try {
A a[100];
const auto& x = [a](A b){return a[37];}((throw 47, a[59]));
}
catch (...) { }
if (ctor != dtor)
return 1;
return 0;
}
Compile command:
clang++ -std=c++11 -o test test.cpp
./test
The main should return with 0 but it now returns 1.
Narrowed down the change and it seems that this change has caused/exposed the
issue.
-----
Author: Richard Smith
Date: Fri Oct 19 19:01:34 2018 +0000
PR24164, PR39336: init-captures are not distinct full-expressions.
Rather, they are subexpressions of the enclosing lambda-expression, and
any temporaries in them are destroyed at the end of that
full-expression, or when the corresponding lambda-expression is
destroyed if they are lifetime-extended.
-----
--
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