summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/p2394.C
blob: 6581f9f2f88c02a31fe4f26ae0bdc7bbb1f80db7 (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
// { dg-do run  }
// prms-id: 2394

class Foo {
 public:
  int x;
  int y;
  Foo(int i, int j) { x = i; y = j; }
} foo(10, 11);

class Wasted { int unsed; };

class Bar : Wasted, public Foo {
public:
  Bar() : Foo(12, 13) { }
} bar;

int
test0() {
  int Foo::* pmi = &Foo::y;
  return (int)(foo.*pmi);
}

int
test1() {
  int Foo::* pmi = &Foo::y;
  return (int)(bar.*pmi);
}

int
main() {
  if (test0() != 11)
    return 1;
  if (test1() != 13)
    return 2;
  return 0;
}