summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/ambig1.C
blob: 95c5eb7cdd817ee50d2850d3e7b763da40721c73 (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
// { dg-do assemble  }
extern "C" int printf(const char *, ...);

struct VB {
  virtual void f() {
    printf("VB\n");
  }
};

class M : public virtual VB {
public:
  int i;
  void f() {
    printf("M(%d)\n", i);
  }
};

class lM : public M {
};

class rM : public M {
};

class D : public lM, rM { // { dg-error "" } ambiguous function
} d;

int main() {
  ((lM*)&d)->i = 1;
  ((rM*)&d)->i = 2;
  ((rM*)&d)->f();
  ((lM*)&d)->f();
  ((VB*)&d)->f();
}