summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/g++.dg/debug/dwarf2/lambda1.C
blob: b315275e387fb3b2065611260a51df832a1d026e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// PR c++/43912
// { dg-do compile { target c++11 } }
// { dg-options "-g -dA -fno-merge-debug-strings -gno-strict-dwarf" }

// Check for the local alias variables that point to the members of the closure.
// { dg-final { scan-assembler-times "DW_TAG_variable\[^.\]*\.ascii \"j.0\"" 4 } }
// { dg-final { scan-assembler-times "DW_TAG_variable\[^.\]*\.ascii \"this.0\"" 2 } }

struct A
{
  int i;
  int f()
  {
    int j;
    [&]() { j = i; }();
    return j;
  }
};

template <class T>
struct B
{
  int i;
  int f()
  {
    int j;
    [&]() { j = i; }();
    return j;
  }
};

int main()
{
  A().f();
  B<int>().f();
}
OpenPOWER on IntegriCloud