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

            Bug ID: 40330
           Summary: Block destructor calls destructor on variable captured
                    by reference
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: sebast...@theophil.net
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

Created attachment 21335
  --> https://bugs.llvm.org/attachment.cgi?id=21335&action=edit
Reproduction

In the attached reproduction, 

- I create an object T on the stack, 
- then capture this object by reference in a lambda
- and in the lambda create a block that again captures this t by reference. 

This seems correct so far because at the point of creation, object T is a
reference. 

Then I convert the (stack allocated) block to a heap allocated block using
_Block_copy and release it using _Block_release. This tries to call the
destructor on the reference to T, which seems to be a bug.

The bug occurs on the latest version of clang for Xcode which reports itself as 
Apple LLVM version 10.0.0 (clang-1000.11.45.2)

-- 
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