[Bug c++/53619] [c++11, regression] wrong capture of "this" in lambda in case of multiple inheritance

2012-06-09 Thread hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53619

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2012-06-09
 CC||jason at gcc dot gnu.org
 Ever Confirmed|0   |1

--- Comment #3 from H.J. Lu  2012-06-09 22:36:39 
UTC ---
It is caused by revision 185768:

http://gcc.gnu.org/ml/gcc-cvs/2012-03/msg01099.html


[Bug c++/53619] [c++11, regression] wrong capture of "this" in lambda in case of multiple inheritance

2012-06-09 Thread vincenzo.innocente at cern dot ch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53619

--- Comment #2 from vincenzo Innocente  
2012-06-09 17:04:10 UTC ---
an even simpler test

 cat lambda_this2.cpp 
#include
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)