[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [LLVMbugs] [Bug 18343] New: Regression: Clang fails to compile lambda with by-ref capture of incompl
From:       bugzilla-daemon () llvm ! org
Date:       2013-12-30 12:35:58
Message-ID: bug-18343-206 () http ! llvm ! org/bugs/
[Download RAW message or body]

--1388406959.A4302.7537
Date: Mon, 30 Dec 2013 06:35:59 -0600
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"

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@nondot.org
          Reporter: jonathan.sauer@gmx.de
                CC: dgregor@apple.com, llvmbugs@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.

--1388406959.A4302.7537
Date: Mon, 30 Dec 2013 06:35:59 -0600
MIME-Version: 1.0
Content-Type: text/html; charset="UTF-8"

<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Regression: Clang fails to compile lambda with by-ref capture of \
incomplete type"  href="http://llvm.org/bugs/show_bug.cgi?id=18343">18343</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression: Clang fails to compile lambda with by-ref capture of \
incomplete type  </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs&#64;nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jonathan.sauer&#64;gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor&#64;apple.com, llvmbugs&#64;cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following program fails to compile with clang r198208, while it \
compiles with clang r197376:

struct Foo;

static void bar(Foo&amp; foo)
{
    [&amp;]() {
        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.

[*]
&lt;<a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131216/09588 \
0.html">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131216/095880.html</a>&gt;</pre>
  </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>

--1388406959.A4302.7537--



_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic