http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61133
Bug ID: 61133
Summary: g++ doesn't implement DR1760
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ville.voutilainen at gmail dot com
Testcase:
int main()
{
auto x = [y = 5](){};
auto z = x.y;
}
The member should not be usable. The most recent WP says
"An init-capture behaves as if it declares and explicitly captures a variable
of the form “auto init-capture ;”
whose declarative region is the lambda-expression’s compound-statement"
and the previous WP said the name of the captured variable should be unique.
See http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1760
I think it was always the intent of captures (including init-captures) that
they do not behave like public members of a class.