summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
Diffstat (limited to 'Examples')
-rw-r--r--Examples/test-suite/common.mk1
-rw-r--r--Examples/test-suite/cpp11_using_typedef_struct.i21
-rw-r--r--Examples/test-suite/javascript/cpp11_using_typedef_struct_runme.js13
3 files changed, 35 insertions, 0 deletions
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index eb80977f7..c781bd930 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -636,6 +636,7 @@ CPP11_TEST_CASES += \
cpp11_uniform_initialization \
cpp11_unrestricted_unions \
cpp11_userdefined_literals \
+ cpp11_using_typedef_struct \
cpp11_variadic_function_templates \
cpp11_variadic_templates \
diff --git a/Examples/test-suite/cpp11_using_typedef_struct.i b/Examples/test-suite/cpp11_using_typedef_struct.i
new file mode 100644
index 000000000..81efdc310
--- /dev/null
+++ b/Examples/test-suite/cpp11_using_typedef_struct.i
@@ -0,0 +1,21 @@
+%module cpp11_using_typedef_struct
+
+%inline
+%{
+namespace nspace1 {
+ typedef struct _xAffineMatrix {
+ int x, y, z;
+ } AffineMatrix;
+
+ struct _xCacheView {
+ int x;
+ };
+ typedef struct _xCacheView CacheView;
+}
+
+using nspace1::AffineMatrix;
+using nspace1::CacheView;
+
+int fn1(AffineMatrix a) { return a.x; };
+int fn2(CacheView a) { return a.x; };
+%}
diff --git a/Examples/test-suite/javascript/cpp11_using_typedef_struct_runme.js b/Examples/test-suite/javascript/cpp11_using_typedef_struct_runme.js
new file mode 100644
index 000000000..43a26ddcd
--- /dev/null
+++ b/Examples/test-suite/javascript/cpp11_using_typedef_struct_runme.js
@@ -0,0 +1,13 @@
+var cpp11_using_typedef_struct = require("cpp11_using_typedef_struct");
+
+var b = new cpp11_using_typedef_struct.AffineMatrix();
+b.x = b.y = b.z = 1;
+
+if (cpp11_using_typedef_struct.fn1(b) != b.x)
+ throw new Error('failed');
+
+var bb = new cpp11_using_typedef_struct._xCacheView();
+bb.x = 123;
+
+if (cpp11_using_typedef_struct.fn2(bb) != 123)
+ throw new Error('failed');