Fix symbol table bug with combinations of using directives and using declarations
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13190 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e4a3a004ae
commit
1ce0058256
5 changed files with 146 additions and 0 deletions
|
|
@ -442,6 +442,7 @@ CPP_TEST_CASES += \
|
|||
using1 \
|
||||
using2 \
|
||||
using_composition \
|
||||
using_directive_and_declaration \
|
||||
using_extend \
|
||||
using_inherit \
|
||||
using_namespace \
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
import using_directive_and_declaration.*;
|
||||
|
||||
public class using_directive_and_declaration_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("using_directive_and_declaration");
|
||||
} 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[])
|
||||
{
|
||||
using_directive_and_declaration.useit1(new Thing1());
|
||||
using_directive_and_declaration.useit2(new Thing2());
|
||||
using_directive_and_declaration.useit3(new Thing3());
|
||||
using_directive_and_declaration.useit4(new Thing4());
|
||||
using_directive_and_declaration.useit5(new Thing5());
|
||||
Thing6a t6a = new Thing6a();
|
||||
t6a.a();
|
||||
Thing6 t6b = new Thing6();
|
||||
t6b.b();
|
||||
using_directive_and_declaration.useit6(t6a, t6b);
|
||||
}
|
||||
}
|
||||
85
Examples/test-suite/using_directive_and_declaration.i
Normal file
85
Examples/test-suite/using_directive_and_declaration.i
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
%module using_directive_and_declaration
|
||||
// Test using directives combined with using declarations
|
||||
|
||||
%inline %{
|
||||
namespace Outer1 {
|
||||
namespace Space1 {
|
||||
class Thing1 {};
|
||||
}
|
||||
}
|
||||
using namespace Outer1::Space1;
|
||||
using Outer1::Space1::Thing1;
|
||||
void useit1(Thing1 t) {}
|
||||
|
||||
|
||||
namespace Outer2 {
|
||||
namespace Space2 {
|
||||
class Thing2 {};
|
||||
}
|
||||
}
|
||||
using namespace Outer2;
|
||||
using Space2::Thing2;
|
||||
void useit2(Thing2 t) {}
|
||||
|
||||
|
||||
namespace Outer3 {
|
||||
namespace Space3 {
|
||||
namespace Middle3 {
|
||||
class Thing3 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
using namespace Outer3;
|
||||
using namespace Space3;
|
||||
using Middle3::Thing3;
|
||||
void useit3(Thing3 t) {}
|
||||
|
||||
|
||||
namespace Outer4 {
|
||||
namespace Space4 {
|
||||
namespace Middle4 {
|
||||
class Thing4 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
using namespace Outer4::Space4;
|
||||
using Middle4::Thing4;
|
||||
void useit4(Thing4 t) {}
|
||||
|
||||
|
||||
namespace Outer5 {
|
||||
namespace Space5 {
|
||||
namespace Middle5 {
|
||||
namespace More5 {
|
||||
class Thing5 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using namespace ::Outer5::Space5;
|
||||
using namespace Middle5;
|
||||
using More5::Thing5;
|
||||
void useit5(Thing5 t) {}
|
||||
|
||||
%}
|
||||
|
||||
// Same symbol name in different namespaces
|
||||
%rename(Thing6a) Outer6::Space6a::Thing6;
|
||||
|
||||
%inline %{
|
||||
namespace Outer6 {
|
||||
namespace Space6a {
|
||||
struct Thing6 {
|
||||
void a() {}
|
||||
};
|
||||
}
|
||||
namespace Space6b {
|
||||
struct Thing6 {
|
||||
void b() {}
|
||||
};
|
||||
}
|
||||
}
|
||||
using namespace Outer6::Space6b;
|
||||
void useit6(Outer6::Space6a::Thing6 ta, Thing6 tb) {}
|
||||
%}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue