This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70383] New: Bogus error when attempting to capture a reference to function by copy
- From: "rs2740 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 23 Mar 2016 21:54:20 +0000
- Subject: [Bug c++/70383] New: Bogus error when attempting to capture a reference to function by copy
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70383
Bug ID: 70383
Summary: Bogus error when attempting to capture a reference to
function by copy
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rs2740 at gmail dot com
Target Milestone: ---
Repro:
void meow() {
void purr();
void (&f)() = purr;
[f]{};
}
Per [expr.prim.lambda]/15, capturing a reference to a function by copy should
result in an unnamed data member that is also a reference to a function. GCC
instead complains:
prog.cc: In function 'void meow()':
prog.cc:4:6: error: field 'meow()::<lambda()>::<f capture>' invalidly declared
function type
[f]{};
^