summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/misc13.C
blob: f85a4f408f6788dcc767c74cd9e6e09616061869 (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
52
53
54
// { dg-do run  }
// GROUPS passed vtable
extern "C" int printf (const char *, ...);
enum E { vf_request, vf_event } want;

int errs = 0;

class ivResource {
public:
  virtual ~ivResource () { }
};

class ivHandler   : public ivResource   {
public:
  virtual void event() { }
};

class ivGlyph   : public ivResource   {
public:
  virtual ~ivGlyph  () { }
  virtual void request () {
    if (want!=vf_request)
      ++errs;
  }
};

class ItemView : public ivGlyph, public ivHandler {
public:
  virtual void event () {
    if (want!=vf_event)
      ++errs;
  }
} a;

ivGlyph *bar() {
  return &a;
}

ivHandler *bar2() {
  return &a;
}

int main() {
  want=vf_request;
  bar()->request();
  want=vf_event;
  bar2()->event();
  if (errs) {
    printf("FAIL\n");
    return 1;
  }
  printf("PASS\n");
  return 0;
}