Fix Python negative unsigned default values

Closes #993
This commit is contained in:
William S Fulton 2017-05-20 23:57:15 +01:00
commit 81ba06e59e
4 changed files with 11 additions and 0 deletions

View file

@ -156,6 +156,9 @@
int double_if_handle_is_null(int n, MyHandle h = 0) { return h ? n : 2*n; }
int double_if_dbl_ptr_is_null(int n, double* null_by_default)
{ return null_by_default ? n : 2*n; }
void defaulted1(unsigned offset = -1U) {} // minus unsigned!
void defaulted2(int offset = -1U) {} // minus unsigned!
};
int Foo::bar = 1;
int Foo::spam = 2;

View file

@ -32,6 +32,8 @@ def run(module_name):
f.newname()
f.newname(1)
f.defaulted1()
f.defaulted2()
if f.double_if_void_ptr_is_null(2, None) != 4:
raise RuntimeError