This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/64915] New: lambda partially drops constness of 'this'
- From: "gene at staubsaal dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Feb 2015 12:25:19 +0000
- Subject: [Bug c++/64915] New: lambda partially drops constness of 'this'
- Auto-submitted: auto-generated
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