[llvm-bugs] [Bug 40330] New: Block destructor calls destructor on variable captured by reference

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 16 03:07:50 PST 2019


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: unassignedclangbugs at nondot.org
          Reporter: sebastian at theophil.net
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190116/a68a8352/attachment.html>


More information about the llvm-bugs mailing list