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)

Reply via email to