blob: b3b97c70c3d305129dd3d046b35d5d95b9541a2b [file] [log] [blame]
// { dg-do run { target c++11 } }
// PR c++/83160 failed to capture as lvalue
int main ()
{
const int a = 0;
if (![&a] (const int *p)
{
const int &b = a;
// We should bind to the outer a
return &b == p;
} (&a))
return 1;
if (![&] (const int *p)
{
const int &b = a;
// We should bind to the outer a
return &b == p;
} (&a))
return 2;
if ([=] (const int *p)
{
const int &b = a;
// We should bind to the captured instance
return &b == p;
}(&a))
return 3;
return 0;
}