[LLVMbugs] [Bug 23856] New: Generic lambda init-captures can't be captured again
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jun 15 18:45:32 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23856
Bug ID: 23856
Summary: Generic lambda init-captures can't be captured again
Product: clang
Version: 3.6
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++14
Assignee: unassignedclangbugs at nondot.org
Reporter: jvp4846 at g.rit.edu
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 14476
--> https://llvm.org/bugs/attachment.cgi?id=14476&action=edit
Test case
Sorry for the confusing bug title; I couldn't come up with a better description
that wasn't incredibly verbose. Anyway...
If you use an init-capture with a generic lambda, and then in turn capture that
capture in another lambda, the compiler fails, thinking that the variable used
in the init-capture's *initializer* is being *captured*. See the test file,
which produces these errors on clang 3.4, 3.5, and 3.6 (full versions below):
--------------------
$ clang++-3.4 -std=c++1y test.cpp
test.cpp:10:17: error: variable 'i' cannot be implicitly captured in a lambda
with no capture-default specified
auto f = [cap=i*2](auto) {
^
test.cpp:5:3: note: in instantiation of function template specialization
'main()::<anonymous class>::operator()<int>' requested here
f(1); // (1)
^
test.cpp:13:3: note: in instantiation of function template specialization
'metafunc<<lambda at test.cpp:10:12> >' requested here
metafunc(f);
^
test.cpp:9:7: note: 'i' declared here
int i = 1;
^
test.cpp:10:12: note: lambda expression begins here
auto f = [cap=i*2](auto) {
^
1 error generated.
--------------------
The full versions of clang are:
Ubuntu clang version 3.4.2- (branches/release_34) (based on LLVM 3.4.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
Debian clang version 3.5.2-svn232162-1~exp1 (branches/release_35) (based on
LLVM 3.5.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
Ubuntu clang version 3.6.0-2ubuntu1~trusty1 (tags/RELEASE_360/final) (based
on LLVM 3.6.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
--
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/20150616/7b822648/attachment.html>
More information about the llvm-bugs
mailing list