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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to