diff --git a/SWIG/Examples/test-suite/director_using.i b/SWIG/Examples/test-suite/director_using.i new file mode 100644 index 000000000..35472035b --- /dev/null +++ b/SWIG/Examples/test-suite/director_using.i @@ -0,0 +1,66 @@ +%module(directors="1",dirprot="1") director_nested + //%module director_nested + +%{ +#include +#include +%} + +%include "std_string.i" + +%feature("director") Bar; + +%newobject *::create(); + +%inline { + template + class Foo { + public: + virtual ~Foo() {} + + std::string advance() + { + return "Foo::advance;" + do_advance(); + } + + protected: + virtual std::string do_advance() = 0; + virtual std::string do_step() const = 0; + }; +} + +%template(Foo_int) Foo; + +%inline { + + class Bar : public Foo + { + public: + + std::string step() + { + return "Bar::step;" + advance(); + } + + + using Foo::do_step; + protected: + std::string do_advance() + { + return "Bar::do_advance;" + do_step(); + } + + }; + + template + class FooBar : public Bar + { + public: + virtual C get_value() const = 0; + using Bar::do_advance; + + }; +} + +%template(FooBar_int) FooBar; + diff --git a/SWIG/Examples/test-suite/using_pointers.i b/SWIG/Examples/test-suite/using_pointers.i new file mode 100644 index 000000000..d6096dbb5 --- /dev/null +++ b/SWIG/Examples/test-suite/using_pointers.i @@ -0,0 +1,17 @@ +%module using_pointers + +%inline %{ + class Foo { + public: + int x; + virtual Foo* blah() { return this; } + }; + + class FooBar : public Foo { + public: + using Foo::blah; + using Foo::x; + }; + +%} + diff --git a/SWIG/Source/Modules/lang.cxx b/SWIG/Source/Modules/lang.cxx index d79b8d29a..be8f11527 100644 --- a/SWIG/Source/Modules/lang.cxx +++ b/SWIG/Source/Modules/lang.cxx @@ -1975,8 +1975,18 @@ int Language::validIdentifier(String *s) { * ----------------------------------------------------------------------------- */ int Language::usingDeclaration(Node *n) { - if (cplus_mode == CPLUS_PUBLIC) { - emit_children(n); + const char* access = 0; + if ((cplus_mode == CPLUS_PUBLIC)) { + Node* np = Copy(n); + Node *c; + for (c = firstChild(np); c; c = nextSibling(c)) { + Setattr(c, "access", "public"); + /* it seems for some cases this is needed, like A* A::boo() */ + if (CurrentClass) + Setattr(c, "parentNode", CurrentClass); + emit_one(c); + } + Delete(np); } return SWIG_OK; }