summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr46149.C
blob: bdc3d77041211df88f28402c3c4d16556f756794 (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
49
50
51
// { dg-do run }
// { dg-options "-fno-tree-sra" }

struct S
{
  S ():p ((char *) __builtin_calloc (1, 1))
  {
  }
  char *p;
};

template < class T > struct A
{
  A (const S & __m1, const T & __m2):m1 (__m1), m2 (__m2)
  {
  }
  const S & m1;
  const T & m2;
};

struct B:A < S >
{
  B (const S & __v):A < S > (__v, __v)
  {
  }
};

struct C:A < B >
{
  C (const S & __e1, const B & __e2):A < B > (__e1, __e2)
  {
  }
};

struct D
{
  D (const C & __c):c (__c)
  {
  }
  const C c;
};

int
main ()
{
  S s;
  B b (s);
  C c (s, b);
  D d (c);
  return d.c.m2.m2.p[0];
}