diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2019-01-21 12:09:01 -0600 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2019-01-21 12:09:01 -0600 |
| commit | 6584a304d5a32d82ee7663d7b8925b2831541a7e (patch) | |
| tree | 816084b8e9b513ec36ec58a513942c3e2649b1bc /tests | |
| parent | c89a741095a4ed4858ea41eee6c412c3fea2e68e (diff) | |
| download | nimterop-6584a304d5a32d82ee7663d7b8925b2831541a7e.tar.gz nimterop-6584a304d5a32d82ee7663d7b8925b2831541a7e.zip | |
Support for empty struct/union
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/include/test.h | 2 | ||||
| -rw-r--r-- | tests/tnimterop_c.nim | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/tests/include/test.h b/tests/include/test.h index 6c62e2f..06eb18e 100644 --- a/tests/include/test.h +++ b/tests/include/test.h @@ -28,6 +28,8 @@ extern "C" { typedef uint8_t PRIMTYPE; typedef PRIMTYPE CUSTTYPE; +struct STRUCT0; + struct STRUCT1 { int field1; }; diff --git a/tests/tnimterop_c.nim b/tests/tnimterop_c.nim index 7123c80..7c4481d 100644 --- a/tests/tnimterop_c.nim +++ b/tests/tnimterop_c.nim @@ -29,7 +29,8 @@ var pt: PRIMTYPE ct: CUSTTYPE - s: STRUCT1 + s0: STRUCT0 + s1: STRUCT1 s2: STRUCT2 s3: STRUCT3 s4: STRUCT4 @@ -52,7 +53,7 @@ var pt = 3 ct = 4 -s.field1 = 5 +s1.field1 = 5 s2.field1 = 6 s3.field1 = 7 s4.field2[2] = 5 @@ -80,7 +81,7 @@ i = 5 check test_call_int() == 5 check test_call_param(5).field1 == 5 check test_call_param2(5, s2).field1 == 11 -check test_call_param3(5, s).field1 == 10 +check test_call_param3(5, s1).field1 == 10 # error: assigning to 'enum ENUM' from incompatible type 'NI' (aka 'long long') when defined(cpp): discard # TODO |
