1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
// PR c++/63207 // { dg-do run { target c++11 } } template <typename T> struct Base { T value; }; template <typename T> struct Test : Base<T> { T test() { const int x = this->value; return ([&]{ return x; })(); } }; int main() { Test<int> t; t.value = 0; return t.test(); }