This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53619] [c++11, regression] wrong capture of "this" in lambda in case of multiple inheritance
- From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 09 Jun 2012 17:04:10 +0000
- Subject: [Bug c++/53619] [c++11, regression] wrong capture of "this" in lambda in case of multiple inheritance
- Auto-submitted: auto-generated
- References: <bug-53619-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53619
--- Comment #2 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2012-06-09 17:04:10 UTC ---
an even simpler test
cat lambda_this2.cpp
#include<cassert>
struct C {
int x;
};
struct B {
int q;
};
struct A : public B , C {
void foo();
};
void A::foo() {
auto k = [this]() {return (void *)(&x);};
assert(k()==(void *)(&x));
}
int main(int l, char **) {
A a; a.foo();
}
c++ -std=gnu++11 lambda_this2.cpp; ./a.out
a.out: lambda_this2.cpp:14: void A::foo(): Assertion `k()==(void *)(&x)'
failed.
Aborted (core dumped)