summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/ref10.C
blob: 4fe6ffdaf43f5a016c9b5300dd033aa2137adaae (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
// { dg-do run  }
// Test that conversion from D* to B*& works properly.

extern "C" int printf (const char *, ...);

struct V {
  int a;
};

struct B: virtual V {
  int b;
};

struct D: B {
  int c;
};

V* gp = 0;

void foo(V * const &r) {
  gp = r;
}

int bar(V *r) {
  return (r != gp);
}

int main() {
  D *p = new D;
  foo(p);
  return bar(p);
}