summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2011-03-02 22:30:05 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2011-03-02 22:30:05 +0000
commit28af783d18c65e5f9aec91e2f9df354b6f47fd47 (patch)
tree5e59b85071f0d0aa3d634d642b857008d0c0d885 /Examples
parenta2ac60e7f32410f4bb091b6a41ce2a023f88591b (diff)
downloadswig-28af783d18c65e5f9aec91e2f9df354b6f47fd47.tar.gz
Templated smart pointers overloaded with both const and non const operator-> generated uncompilable code when the pointee was a class with either public member variables or static methods.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12512 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples')
-rw-r--r--Examples/test-suite/common.mk1
-rw-r--r--Examples/test-suite/smart_pointer_template_const_overload.i35
2 files changed, 36 insertions, 0 deletions
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 756d6cbab..1e0665f66 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -313,6 +313,7 @@ CPP_TEST_CASES += \
smart_pointer_rename \
smart_pointer_simple \
smart_pointer_static \
+ smart_pointer_template_const_overload \
smart_pointer_templatemethods \
smart_pointer_templatevariables \
smart_pointer_typedef \
diff --git a/Examples/test-suite/smart_pointer_template_const_overload.i b/Examples/test-suite/smart_pointer_template_const_overload.i
new file mode 100644
index 000000000..be5f08a35
--- /dev/null
+++ b/Examples/test-suite/smart_pointer_template_const_overload.i
@@ -0,0 +1,35 @@
+%module smart_pointer_template_const_overload
+
+%warnfilter(SWIGWARN_LANG_OVERLOAD_IGNORED) SmartPointer<FooImplementation>::operator->; // Overloaded method SmartPointer< FooImplementation >::operator ->() ignored
+
+%inline %{
+ template <class T> class SmartPointer {
+ T *ptr;
+ public:
+ SmartPointer(T *t = 0) : ptr(t) {}
+ inline const T * operator->() const { return ptr; }
+ inline T * operator->() { return ptr; }
+ };
+
+ class FooImplementation {
+ public:
+ int mingy() {}
+ int constmingy() const {}
+ static int thingy() {}
+ static int svariable;
+ static const int constsvariable = 2;
+ int normalvariable;
+ };
+
+ void tester() {
+ SmartPointer<FooImplementation> p;
+ p->mingy();
+ p->constmingy();
+ p->thingy();
+ int a = p->svariable;
+ a = p->constsvariable;
+ a = p->normalvariable;
+ }
+%}
+
+%template(FooSmartPointer) SmartPointer<FooImplementation>;