summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr43879-1_1.C
blob: 0c943381fa325a6add73f90df2310aa362d342e8 (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
48
/* { dg-do run } */
/* { dg-options "-fipa-pta" } */
/* { dg-additional-sources "pr43879-1_0.C" } */

struct A {
    int *i;
    A();
    ~A();
};

static inline int
aa(int *a, int *b)
{
  (void)b;
  return *a;
}

struct B {
    B() : i(0) {}
    int i;
    B(const A &a) : i(0)
    {
      f(*a.i);
    }
    void __attribute__((noinline, noclone))
	f(int j)
	  {
	    aa(&i, &j);
	    i = 1;
	  }
};

int
test()
{
  B b1;
  B b2 = B(A());
  b1 = B(A());
  if (b1.i != b2.i) __builtin_abort();
  return 0;
}

int
main()
{
  return test();
}