File tree 2 files changed +34
-0
lines changed
2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ #ifndef header_h__
2
+ #define header_h__
3
+
4
+ class A {
5
+ public:
6
+ int a;
7
+ int b;
8
+ A (int a, int b) : a(a), b(b) {}
9
+ ~A () {}
10
+ };
11
+ static_assert (sizeof (A) == 8, "size should be 8");
12
+
13
+ #endif // defined(header_h__)
Original file line number Diff line number Diff line change @@ -9,8 +9,14 @@ mod inner;
9
9
cpp ! { {
10
10
#define _USE_MATH_DEFINES
11
11
#include <math. h>
12
+ #include "src/header.h"
12
13
} }
13
14
15
+ #[ repr( C ) ]
16
+ struct A {
17
+ _opaque : [ i32 ; 2 ] ,
18
+ }
19
+
14
20
#[ test]
15
21
fn captures ( ) {
16
22
let x: i32 = 10 ;
@@ -66,3 +72,18 @@ fn plusplus() {
66
72
assert_eq ! ( x, 1 ) ;
67
73
}
68
74
}
75
+
76
+ #[ test]
77
+ fn destructor ( ) {
78
+ unsafe {
79
+ let a = cpp ! ( [ ] -> A as "A" {
80
+ return A ( 5 , 10 ) ;
81
+ } ) ;
82
+
83
+ let first = cpp ! ( [ a as "A" ] -> i32 as "int32_t" {
84
+ return a. a;
85
+ } ) ;
86
+
87
+ assert_eq ! ( first, 5 ) ;
88
+ }
89
+ }
You can’t perform that action at this time.
0 commit comments