| 1 |
// PR c++/43912 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-gdwarf-2 -dA -fno-merge-debug-strings -gno-strict-dwarf -fno-inline" } |
| 4 |
|
| 5 |
// Check for the local alias variables that point to the members of the closure. |
| 6 |
// { dg-final { scan-assembler-times "DW_TAG_variable\[^.\]*\.ascii \"j.0\"" 4 { xfail { powerpc-ibm-aix* } } } } |
| 7 |
// { dg-final { scan-assembler-times "DW_TAG_variable\[^.\]*\.ascii \"this.0\"" 2 { xfail { powerpc-ibm-aix* } } } } |
| 8 |
|
| 9 |
struct A |
| 10 |
{ |
| 11 |
int i; |
| 12 |
int f() |
| 13 |
{ |
| 14 |
int j; |
| 15 |
[&]() { j = i; }(); |
| 16 |
return j; |
| 17 |
} |
| 18 |
}; |
| 19 |
|
| 20 |
template <class T> |
| 21 |
struct B |
| 22 |
{ |
| 23 |
int i; |
| 24 |
int f() |
| 25 |
{ |
| 26 |
int j; |
| 27 |
[&]() { j = i; }(); |
| 28 |
return j; |
| 29 |
} |
| 30 |
}; |
| 31 |
|
| 32 |
int main() |
| 33 |
{ |
| 34 |
A().f(); |
| 35 |
B<int>().f(); |
| 36 |
} |