1/* { dg-do compile } */
2/* { dg-options "-O1 -fdump-tree-vars-details" } */
3
4void link_error();
5
6struct OOf {
7        int value;
8        OOf() {value = 0;}
9};
10inline OOf operator+(OOf op1, OOf op2)
11{
12        OOf f;
13        f.value = op1.value + op2.value;
14        return f;
15}
16inline OOf operator*(OOf op1, OOf op2)
17{
18        OOf f;
19        f.value = op1.value * op2.value;
20        return f;
21}
22inline OOf operator-(OOf op1, OOf op2)
23{
24        OOf f;
25        f.value = op1.value - op2.value;
26        return f;
27}
28inline OOf test_func(
29        OOf a,
30        OOf b,
31        OOf c
32)
33{
34        OOf d, e;
35        OOf result;
36        d = a * b + b * c;
37        e = a * c - b * d;
38        result = d * e;
39        return result;
40}
41
42void test()
43{
44  OOf a, b, c;
45  OOf d = test_func (a,b,c);
46  if (d.value)
47    link_error();
48}
49
50/* We should have removed the casts from pointers to references and caused SRA to happen.  */
51/* { dg-final { scan-tree-dump-times "link_error" 0 "vars"} } */
52/* { dg-final { cleanup-tree-dump "vars" } } */
53