https://llvm.org/bugs/show_bug.cgi?id=31386
Bug ID: 31386 Summary: All temporaries aren't destroyed in InitListExpr filler Product: clang Version: 3.9 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: C++11 Assignee: unassignedclangb...@nondot.org Reporter: stephane.zimmerm...@trust-in-soft.com CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified Created attachment 17757 --> https://llvm.org/bugs/attachment.cgi?id=17757&action=edit Test case The file: #include <cstdio> class Foo { static int counter; public: int objectID; Foo() { objectID = counter++; } Foo(const Foo&) { objectID = counter++; } ~Foo() { printf("~Foo() : %d\n", objectID); } }; int Foo::counter = 0; struct Bar { Bar(Foo f = Foo()) {} }; int main(void) { Bar b[13] = { Foo(), Foo() }; return 0; } compiled with Clang has as output: $ clang++ test.cpp && ./a.out ~Foo() : 12 ~Foo() : 1 ~Foo() : 0 which shows that only the last temporary used in the creation of b is destroyed. -- 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