https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64915
Bug ID: 64915
Summary: lambda partially drops constness of 'this'
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gene at staubsaal dot de
When calling a non-const member function inside a lambda expression the
constness of 'this' is being ignored:
Example example.cpp:
struct Foo {
int x;
void bar() const {
[=]() { bad(); }(); // This sould be an compiler error
}
void bad() {
x = 42;
}
};
compiled with: g++ -std=c++11 -Wall -Wextra
More Info
$ gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2