aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/using_member_scopes.i
diff options
context:
space:
mode:
authorAlistair Delva <adelva@google.com>2024-04-10 14:15:29 -0700
committerAlistair Delva <adelva@google.com>2024-04-11 12:58:28 -0700
commitd0f0f90be16c2ac553b5fa08512045273135147a (patch)
tree5d9ebb7a04807ea8a609ddd18b0162bc87530e4b /Examples/test-suite/using_member_scopes.i
parent6ffc1dbf29ba98c4d8aa71ebc9b484e973fe1030 (diff)
downloadswig-d0f0f90be16c2ac553b5fa08512045273135147a.tar.gz
Update to v4.2.1HEADmastermain
Change-Id: I47cef2be94299220d80265d949a95b58eee2c23b
Diffstat (limited to 'Examples/test-suite/using_member_scopes.i')
-rw-r--r--Examples/test-suite/using_member_scopes.i85
1 files changed, 85 insertions, 0 deletions
diff --git a/Examples/test-suite/using_member_scopes.i b/Examples/test-suite/using_member_scopes.i
new file mode 100644
index 000000000..3245c9cc7
--- /dev/null
+++ b/Examples/test-suite/using_member_scopes.i
@@ -0,0 +1,85 @@
+%module using_member_scopes
+
+// Fully qualifying parameter types in a method declared after the using declaration caused
+// a method being incorrectly added by the using declaration even though the declaration already existed
+
+%inline %{
+namespace OgreBites
+{
+ struct NativeWindowType {};
+ class ApplicationContextBase {
+ public:
+ virtual ~ApplicationContextBase() {}
+ virtual void setWindowGrab(NativeWindowType* win, bool grab = true) {}
+ void setWindowGrab(bool grab = true) {}
+ };
+ class ApplicationContextSDL : public ApplicationContextBase {
+ public:
+ using ApplicationContextBase::setWindowGrab;
+ void setWindowGrab(NativeWindowType* win, bool grab = true) {} // This should not be added again as it exists in base class
+ };
+/*
+typedef not working yet
+ class ApplicationContextSDL2 : public ApplicationContextBase {
+ public:
+ using ApplicationContextBase::setWindowGrab;
+ typedef NativeWindowType* pNWT;
+ void setWindowGrab(pNWT win, bool grab) {} // This should not be added again as it exists in base class
+ };
+*/
+}
+%}
+
+
+%inline %{
+// Test using declaration in various positions before and after overloaded methods
+// Testing where the derived class overrides all the base class methods (and more)
+namespace Bites
+{
+ struct Base
+ {
+ virtual ~Base() {}
+ virtual void grab() {}
+ virtual void grab(int i) {}
+ };
+ struct Derived1 : public Base
+ {
+ using Base::grab;
+ virtual void grab() {}
+ virtual void grab(int i) {}
+ };
+ struct Derived2 : public Base
+ {
+ using Base::grab;
+ virtual void grab() {}
+ virtual void grab(int i) {}
+ virtual void grab(int i, double d) {}
+ };
+ struct Derived3 : public Base
+ {
+ virtual void grab() {}
+ using Base::grab;
+ virtual void grab(int i) {}
+ };
+ struct Derived4 : public Base
+ {
+ virtual void grab() {}
+ using Base::grab;
+ virtual void grab(int i) {}
+ virtual void grab(int i, double d) {}
+ };
+ struct Derived5 : public Base
+ {
+ virtual void grab() {}
+ virtual void grab(int i) {}
+ using Base::grab;
+ };
+ struct Derived6 : public Base
+ {
+ virtual void grab() {}
+ virtual void grab(int i) {}
+ virtual void grab(int i, double d) {}
+ using Base::grab;
+ };
+}
+%}