1 %module nested_scope 2 3 #if !defined(SWIGCSHARP) && !defined(SWIGJAVA) 4 %feature ("flatnested"); 5 #endif 6 7 %inline %{ 8 namespace ns { 9 // "global" is a case-insensitive keyword in PHP. 10 struct Global_ { 11 #ifdef __clang__ 12 struct Outer { 13 struct Nested; 14 struct Nested { 15 int data; 16 }; 17 }; 18 struct Outer::Nested instance; 19 #else 20 struct Outer { 21 struct Nested; 22 }; 23 struct Outer::Nested { 24 int data; 25 } instance; 26 #endif 27 }; 28 } 29 class Outer1 { 30 struct Nested1; 31 public: 32 struct Nested2; 33 #ifdef __clang__ 34 struct Nested2 { 35 int data; 36 }; 37 #endif 38 template <class T> class AbstractClass; 39 class Real; 40 }; 41 #ifndef __clang__ 42 struct Outer1::Nested2 { 43 int data; 44 }; 45 #endif 46 47 class Klass { 48 public: 49 template <class T> class AbstractClass; 50 class Real; 51 }; 52 53 template <class T> class Klass::AbstractClass { 54 public: 55 virtual void Method() = 0; ~AbstractClass()56 virtual ~AbstractClass() {} 57 }; 58 %} 59 60 %template(abstract_int) Klass::AbstractClass <int>; 61 62 %inline %{ 63 class Klass::Real : public AbstractClass <int> { 64 public: Method()65 virtual void Method() {} 66 }; 67 %} 68