summaryrefslogtreecommitdiff
path: root/tests/exec
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-10 18:45:19 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-10 18:45:19 +0100
commit2c7d3a47508e2323cd70d8f65324d8c3d01e51d0 (patch)
tree294b28c4ab8b10ff14af07a206b5cdb997a645a3 /tests/exec
parentc4fca6ff8ffa7ad8e6129dd0f6fe1b72d58c950f (diff)
parenta95f51e847892fe0e358c519cc4bac42382fbbb7 (diff)
downloadLPC-Projet-2c7d3a47508e2323cd70d8f65324d8c3d01e51d0.tar.gz
LPC-Projet-2c7d3a47508e2323cd70d8f65324d8c3d01e51d0.zip
Merge branch 'master' into codegen-optHEADmaster
Conflicts: src/codegen.ml
Diffstat (limited to 'tests/exec')
-rw-r--r--tests/exec/multi_virt.cpp46
-rw-r--r--tests/exec/multi_virt.out5
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/exec/multi_virt.cpp b/tests/exec/multi_virt.cpp
new file mode 100644
index 0000000..c0950b7
--- /dev/null
+++ b/tests/exec/multi_virt.cpp
@@ -0,0 +1,46 @@
+#include <iostream>
+
+class A { public : int a; virtual void fa();};
+class B { public : int b; virtual void fb(); virtual void h();};
+
+class C : public A, public B { public : int c; virtual void fc();};
+
+class D { public : int d; virtual void fd(); virtual void h();};
+class E : public C, public D { public : int e; virtual void fb(); virtual void fd(); virtual void h();};
+
+void B::fb() {std::cout << "B::fb";}
+void E::fb() {std::cout << "E::fb";}
+void A::fa() {std::cout << "A::fa";}
+void D::fd() {std::cout << "D::fd";}
+void E::fd() {std::cout << "E::fd";}
+void C::fc() {std::cout << "E::fc";}
+
+void E::h() {std::cout << "E::h";}
+void B::h() {std::cout << "B::h";}
+void D::h() {std::cout << "D::h";}
+
+
+int main() {
+
+ E* cp = new E();
+ cp->h();
+ std::cout << "\n";
+ cp->fd();
+ std::cout << "\n";
+
+ D* dp = new E() ;
+ dp->h();
+ std::cout << "\n";
+ dp->fd();
+ std::cout << "\n";
+
+ A* ap = new C() ;
+ ap->fa();
+
+ std::cout << "\n";
+
+ return 0;
+}
+
+
+
diff --git a/tests/exec/multi_virt.out b/tests/exec/multi_virt.out
new file mode 100644
index 0000000..82c07a5
--- /dev/null
+++ b/tests/exec/multi_virt.out
@@ -0,0 +1,5 @@
+E::h
+E::fd
+E::h
+E::fd
+A::fa