Commit e5347fad authored by Ian Henriksen's avatar Ian Henriksen

Added tests to verify that c++ call operator overloading works with

overloaded signatures when using stack allocated objects.
parent 09874820
...@@ -19,6 +19,8 @@ public: ...@@ -19,6 +19,8 @@ public:
wint() { val = 0; } wint() { val = 0; }
wint(long long val) { this->val = val; } wint(long long val) { this->val = val; }
long long &operator()() { return this->val; } long long &operator()() { return this->val; }
long long operator()(long long i) { return this->val + i; }
long long operator()(long long i, long long j) { return this->val + i + j; }
}; };
######## call.pxd ######## ######## call.pxd ########
...@@ -29,6 +31,8 @@ cdef extern from "call.cpp" nogil: ...@@ -29,6 +31,8 @@ cdef extern from "call.cpp" nogil:
wint() wint()
wint(long long val) wint(long long val)
long long& operator()() long long& operator()()
long long operator()(long long i)
long long operator()(long long i, long long j)
######## call_stack_allocated.pyx ######## ######## call_stack_allocated.pyx ########
...@@ -39,4 +43,8 @@ def test(): ...@@ -39,4 +43,8 @@ def test():
cdef long long b = 3 cdef long long b = 3
b = a() b = a()
assert b == 4 assert b == 4
b = a(1ll)
assert b == 5
b = a(1ll, 1ll)
assert b == 6
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment