summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/debug/pr46123.C
blob: 9e115cd06da80b1fe382a69c818ba7d1b68a09d6 (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
37
38
39
40
41
42
43
44
45
46
47
// PR debug/46123
// { dg-do compile }
// { dg-options "-g -feliminate-dwarf2-dups" }

struct foo
{
  static int bar ()
  {
    int i;
    static int baz = 1;
    {
      static int baz = 2;
      i = baz++;
    }
    {
      struct baz
      {
	static int m ()
	{
	  static int n;
	  return n += 10;
	}
      };
      baz a;
      i += a.m ();
    }
    {
      static int baz = 3;
      i += baz;
      baz += 30;
    }
    i += baz;
    baz += 60;
    return i;
  }
};

int main ()
{
  foo x;

  if (x.bar () != 16)
    return 1;
  if (x.bar() != 117)
    return 1;
  return 0;
}