summaryrefslogtreecommitdiff
path: root/tests/typing
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-09 11:49:54 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-09 11:49:54 +0100
commitd0798a5e0d3828b491ed35b2f62edf6aef199e2b (patch)
tree56a17e80d66da133da675e6f6a2ad6d9138520d2 /tests/typing
parent56fdab2ff0caaaa88a152ef06aef821f432fe488 (diff)
downloadLPC-Projet-d0798a5e0d3828b491ed35b2f62edf6aef199e2b.tar.gz
LPC-Projet-d0798a5e0d3828b491ed35b2f62edf6aef199e2b.zip
Reject redefinition of virtual methods with different return type.
Diffstat (limited to 'tests/typing')
-rw-r--r--tests/typing/bad/testfile-invalid-virtual-redef.cpp11
-rw-r--r--tests/typing/good/testfile-return-type-redef.cpp11
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/typing/bad/testfile-invalid-virtual-redef.cpp b/tests/typing/bad/testfile-invalid-virtual-redef.cpp
new file mode 100644
index 0000000..263ec62
--- /dev/null
+++ b/tests/typing/bad/testfile-invalid-virtual-redef.cpp
@@ -0,0 +1,11 @@
+class A {
+ public:
+ virtual int f(int x);
+};
+
+class B : public A {
+ public:
+ virtual void f(int x);
+};
+
+int main() {}
diff --git a/tests/typing/good/testfile-return-type-redef.cpp b/tests/typing/good/testfile-return-type-redef.cpp
new file mode 100644
index 0000000..ff14d00
--- /dev/null
+++ b/tests/typing/good/testfile-return-type-redef.cpp
@@ -0,0 +1,11 @@
+class A {
+ public:
+ int f(int x);
+};
+
+class B : public A {
+ public:
+ void f(int x);
+};
+
+int main() {}