summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/20121105-1.C
blob: 10eeeb90945132a09e1093e9d198f20d81d61007 (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
// PR tree-optimization/54986
// Reported by Remi Vanicat <vanicat@debian.org>
// Reduced testcase by Markus Trippelsdorf <markus@trippelsdorf.de> 

__extension__ typedef __INTPTR_TYPE__ intptr_t;

struct A;
struct B
{
  int *_ptr;
  bool operator==(B *p1)
  {
    return p1->_ptr;
  }
};
struct C {
  A* ref_SYMBptr();
};
struct A
{
  B sommet;
};
typedef C *gen_op_context;
struct D
{
  D(gen_op_context) {}
};

D c(0);
const intptr_t d = (intptr_t)&c;
B *const   e = (B *)&d;

static bool
fn1(C& p1)
{
  return p1.ref_SYMBptr()->sommet == e;
}

void
fn2()
{
  C b;
  fn1(b);
}