[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:
David Nadlinger 2011-01-29 21:32:11 +00:00
commit b9d12afa7c
3 changed files with 49 additions and 20 deletions

View file

@ -15,6 +15,19 @@ void main() {
check!(f, SWIGTYPE_p_OpaqueClass); check!(f, SWIGTYPE_p_OpaqueClass);
check!(g, void function(int**, char***)); check!(g, void function(int**, char***));
check!(h, SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void); 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)() { void check(alias F, T)() {

View file

@ -15,6 +15,19 @@ void main() {
check!(f, SWIGTYPE_p_OpaqueClass); check!(f, SWIGTYPE_p_OpaqueClass);
check!(g, void function(int**, char***)); check!(g, void function(int**, char***));
check!(h, SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void); 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)() { void check(alias F, T)() {

View file

@ -15,4 +15,7 @@
OpaqueClass *f( OpaqueClass *value ){ return value; } OpaqueClass *f( OpaqueClass *value ){ return value; }
FuncA g( FuncA value ){ return value; } FuncA g( FuncA value ){ return value; }
FuncB* h( FuncB* value ){ return value; } FuncB* h( FuncB* value ){ return value; }
int &refA( int &value ){ return value; }
float *&refB( float *&value ){ return value; }
%} %}