[llvm-bugs] [Bug 33040] New: Destructors not called for temporaries created during array initialization

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 15 08:03:41 PDT 2017


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

            Bug ID: 33040
           Summary: Destructors not called for temporaries created during
                    array initialization
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: t.p.northover at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Spotted by Adam Nowacki, and it certainly looks dodgy to me. Only one of the
objects gets destroyed in the following code:

#include <stdio.h>
struct A {
  ~A() {
    printf("Destroying\n");
  }
};
A make_a() {
  return A();
}
struct B {
    B(A a = make_a()) {};
};

int main() {
    B b[5] = {};
}

-- 
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/20170515/8ccb2f55/attachment.html>


More information about the llvm-bugs mailing list