summaryrefslogtreecommitdiff
path: root/Examples/test-suite/constover.i
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/constover.i')
-rw-r--r--Examples/test-suite/constover.i38
1 files changed, 38 insertions, 0 deletions
diff --git a/Examples/test-suite/constover.i b/Examples/test-suite/constover.i
new file mode 100644
index 000000000..06f9ac7e2
--- /dev/null
+++ b/Examples/test-suite/constover.i
@@ -0,0 +1,38 @@
+// This test checks SWIG's code generation for C++ functions
+// and methods that differ only in constness.
+
+%module constover
+
+%rename(test_pconst) test(const char *);
+%rename(test_constm) test(char *) const;
+%rename(test_pconstm) test(const char *) const;
+
+%inline %{
+
+char *test(char *x) {
+ return (char *) "test";
+}
+
+char *test(const char *x) {
+ return (char *) "test_pconst";
+}
+
+ class Foo {
+ public:
+ Foo() { }
+ char *test(char *x) {
+ return (char *) "test";
+ }
+ char *test(const char *x) {
+ return (char *) "test_pconst";
+ }
+ char *test(char *x) const {
+ return (char *) "test_constmethod";
+ }
+ char *test(const char *x) const {
+ return (char *) "test_pconstmethod";
+ }
+ };
+
+%}
+