| 1 |
// N3648: capture init |
| 2 |
// { dg-options "-w" } |
| 3 |
// { dg-do run { target c++14 } } |
| 4 |
|
| 5 |
int main() |
| 6 |
{ |
| 7 |
int x = 41; |
| 8 |
auto r = [x = x+1]{ return x; }(); |
| 9 |
if (r != 42) __builtin_abort(); |
| 10 |
|
| 11 |
static auto *p = &r; |
| 12 |
[&x=r]{ if (&x != p) __builtin_abort(); }(); |
| 13 |
} |