summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/ambig1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.mike/ambig1.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/ambig1.C33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ambig1.C b/gcc/testsuite/g++.old-deja/g++.mike/ambig1.C
new file mode 100644
index 000000000..95c5eb7cd
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.mike/ambig1.C
@@ -0,0 +1,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();
+}