Fix type lookup in the presence of using directives and using declarations
Fix some cases of type lookup failure via a combination of both using directives and
using declarations resulting in C++ code that did not compile as the generated type was
not fully qualified for use in the global namespace. Example below:
namespace Space5 {
namespace SubSpace5 {
namespace SubSubSpace5 {
struct F {};
}
}
using namespace SubSpace5;
using SubSubSpace5::F;
void func(SubSubSpace5::F f);
}
This commit is contained in:
parent
8bf81b8718
commit
bf98c5304f
6 changed files with 139 additions and 30 deletions
|
|
@ -73,8 +73,7 @@ namespace Space5 {
|
|||
struct SubSubSpace5::F {
|
||||
void ff(Space5::SubSpace5::SubSubSpace5::F, SubSpace5::SubSubSpace5::F, SubSubSpace5::F, F) {}
|
||||
};
|
||||
// needs fixing
|
||||
void fff(Space5::SubSpace5::SubSubSpace5::F, SubSpace5::SubSubSpace5::F, /*SubSubSpace5::F,*/ F) {}
|
||||
void fff(Space5::SubSpace5::SubSubSpace5::F, SubSpace5::SubSubSpace5::F, SubSubSpace5::F, F) {}
|
||||
}
|
||||
|
||||
namespace Space6 {
|
||||
|
|
|
|||
|
|
@ -292,6 +292,7 @@ CPP_TEST_CASES += \
|
|||
multiple_inheritance_shared_ptr \
|
||||
name_cxx \
|
||||
name_warnings \
|
||||
namespace_chase \
|
||||
namespace_class \
|
||||
namespace_enum \
|
||||
namespace_extend \
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class class_scope_namespace_runme {
|
|||
class_scope_namespace.ccc(c, c);
|
||||
class_scope_namespace.ddd(d, d, d);
|
||||
class_scope_namespace.eee(e, e, e);
|
||||
class_scope_namespace.fff(f, f, f);
|
||||
class_scope_namespace.fff(f, f, f, f);
|
||||
class_scope_namespace.ggg(g, g);
|
||||
class_scope_namespace.hhh(h);
|
||||
class_scope_namespace.iii(i, i);
|
||||
|
|
|
|||
26
Examples/test-suite/java/namespace_chase_runme.java
Normal file
26
Examples/test-suite/java/namespace_chase_runme.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
import namespace_chase.*;
|
||||
|
||||
public class namespace_chase_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("namespace_chase");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[])
|
||||
{
|
||||
Struct1A s1a = new Struct1A();
|
||||
Struct1B s1b = new Struct1B();
|
||||
Struct1C s1c = new Struct1C();
|
||||
|
||||
namespace_chase.sss3a(s1a, s1b, s1c);
|
||||
namespace_chase.sss3b(s1a, s1b, s1c);
|
||||
// needs fixing
|
||||
// namespace_chase.sss3c(s1a, s1b, s1c);
|
||||
}
|
||||
}
|
||||
36
Examples/test-suite/namespace_chase.i
Normal file
36
Examples/test-suite/namespace_chase.i
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
%module namespace_chase
|
||||
|
||||
%inline %{
|
||||
namespace Space1A {
|
||||
struct Struct1A {};
|
||||
namespace Space1B {
|
||||
struct Struct1B {};
|
||||
namespace Space1C {
|
||||
struct Struct1C {};
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Space2A {
|
||||
using namespace Space1A;
|
||||
namespace Space2B {
|
||||
using namespace Space1B;
|
||||
namespace Space2C {
|
||||
using namespace Space1C;
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Space3 {
|
||||
using namespace Space2A;
|
||||
void sss3a(Space1A::Struct1A, Space1A::Space1B::Struct1B, Space1A::Space1B::Space1C::Struct1C) {}
|
||||
void sss3b(Struct1A, Space1B::Struct1B, Space1B::Space1C::Struct1C) {}
|
||||
// To fix: the last two parameters below fail and result in SWIGTYPE_ types instead of proxy classes
|
||||
void sss3c(Space2A::Struct1A, Space2A::Space1B::Struct1B, Space2A::Space1B::Space1C::Struct1C) {}
|
||||
}
|
||||
namespace Space4 {
|
||||
using namespace Space2A;
|
||||
using namespace Space2A::Space2B;
|
||||
using namespace Space2A::Space2B::Space2C;
|
||||
void sss4a(Struct1A, Struct1B, Space2C::Struct1C) {}
|
||||
void sss4b(Struct1A, Struct1B, Struct1C) {}
|
||||
}
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue