This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51979] New: variadic templates + lambda capture list = error
- From: "i.nixman at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Jan 2012 11:07:49 +0000
- Subject: [Bug c++/51979] New: variadic templates + lambda capture list = error
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51979
Bug #: 51979
Summary: variadic templates + lambda capture list = error
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: i.nixman@gmail.com
The following code:
template <class... Args> void foo(Args... args) {}
template <class... Args> void bar(Args... args) {
auto lambda = [=, args...]() {
foo(args...);
};
}
produce this error:
>g++ -std=c++0x lambd.cpp -olambd
lambd.cpp: In function 'void bar(Args ...)':
lambd.cpp:3:25: error: expected ',' before '...' token
lambd.cpp:3:25: error: expected identifier before '...' token
lambd.cpp:3:28: error: parameter packs not expanded with '...':
lambd.cpp:3:28: note: 'args'
lambd.cpp: In lambda function:
lambd.cpp:4:13: error: expansion pattern '((const bar(Args
...)::<lambda()>*)this)->bar(Args ...)::<lambda()>::args' contains no argument
packs
example from c++ draft 5.1.2.23:
template<class... Args>
void f(Args... args) {
auto lm = [&, args...] { return g(args...); };
lm();
}