[D] Test C++ references in »d_nativepointers«; normalized indentation.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12407 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
160ee9c937
commit
b9d12afa7c
3 changed files with 49 additions and 20 deletions
|
|
@ -15,6 +15,19 @@ void main() {
|
|||
check!(f, SWIGTYPE_p_OpaqueClass);
|
||||
check!(g, void function(int**, char***));
|
||||
check!(h, SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void);
|
||||
|
||||
{
|
||||
static assert(is(int* function(int*) == typeof(&refA)));
|
||||
int v = 2;
|
||||
assert(*refA(&v) == 2);
|
||||
}
|
||||
|
||||
{
|
||||
static assert(is(float** function(float**) == typeof(&refB)));
|
||||
float v = 1.0;
|
||||
float* p = &v;
|
||||
assert(**refB(&p) == 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
void check(alias F, T)() {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,19 @@ void main() {
|
|||
check!(f, SWIGTYPE_p_OpaqueClass);
|
||||
check!(g, void function(int**, char***));
|
||||
check!(h, SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void);
|
||||
|
||||
{
|
||||
static assert(is(int* function(int*) == typeof(&refA)));
|
||||
int v = 2;
|
||||
assert(*refA(&v) == 2);
|
||||
}
|
||||
|
||||
{
|
||||
static assert(is(float** function(float**) == typeof(&refB)));
|
||||
float v = 1.0;
|
||||
float* p = &v;
|
||||
assert(**refB(&p) == 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
void check(alias F, T)() {
|
||||
|
|
|
|||
|
|
@ -15,4 +15,7 @@
|
|||
OpaqueClass *f( OpaqueClass *value ){ return value; }
|
||||
FuncA g( FuncA value ){ return value; }
|
||||
FuncB* h( FuncB* value ){ return value; }
|
||||
|
||||
int &refA( int &value ){ return value; }
|
||||
float *&refB( float *&value ){ return value; }
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue