[LLVMbugs] [Bug 18343] New: Regression: Clang fails to compile lambda with by-ref capture of incomplete type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 30 04:35:58 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=18343

            Bug ID: 18343
           Summary: Regression: Clang fails to compile lambda with by-ref
                    capture of incomplete type
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jonathan.sauer at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following program fails to compile with clang r198208, while it compiles
with clang r197376:

struct Foo;

static void bar(Foo& foo)
{
    [&]() {
        foo;
    };
}


This results in: 

% ~/LLVM/build/Release+Asserts/bin/clang++ -c -std=c++11 clang.cpp
clang.cpp:6:9: error: by-copy capture of variable 'foo' with incomplete type
'Foo'
        foo;
        ^
clang.cpp:1:8: note: forward declaration of 'Foo'
struct Foo;
       ^
[2 warnings about unused expression result]
2 warnings and 1 error generated.


This seems to have been introduced in r197623[*] with a fix to require a
by-copy capture to have a complete type. I don't think completeness is
necessary for by-ref captures.

[*]
<http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131216/095880.html>

-- 
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/20131230/3501bfd8/attachment.html>


More information about the llvm-bugs mailing list