Commit 25ba3870 authored by Robert Bradshaw's avatar Robert Bradshaw
parents c065026e fbed3e79
...@@ -4678,6 +4678,8 @@ class SimpleCallNode(CallNode): ...@@ -4678,6 +4678,8 @@ class SimpleCallNode(CallNode):
self.type = PyrexTypes.error_type self.type = PyrexTypes.error_type
self.result_code = "<error>" self.result_code = "<error>"
return return
self.function.type = overloaded_entry.type
overloaded_entry = None
elif hasattr(self.function, 'entry'): elif hasattr(self.function, 'entry'):
overloaded_entry = self.function.entry overloaded_entry = self.function.entry
elif (isinstance(self.function, IndexNode) and elif (isinstance(self.function, IndexNode) and
...@@ -4707,7 +4709,7 @@ class SimpleCallNode(CallNode): ...@@ -4707,7 +4709,7 @@ class SimpleCallNode(CallNode):
else: else:
entry = None entry = None
func_type = self.function_type() func_type = self.function_type()
if not func_type.is_cfunction: if not (func_type.is_cfunction or func_type.is_cpp_class):
error(self.pos, "Calling non-function type '%s'" % func_type) error(self.pos, "Calling non-function type '%s'" % func_type)
self.type = PyrexTypes.error_type self.type = PyrexTypes.error_type
self.result_code = "<error>" self.result_code = "<error>"
......
# tag: cpp
"""
PYTHON setup.py build_ext --inplace
PYTHON -c "from call_stack_allocated import test; test()"
"""
######## setup.py ########
from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules=cythonize('*.pyx', language='c++'))
######## call.cpp ########
class wint {
public:
long long val;
wint() { val = 0; }
wint(long long val) { this->val = val; }
long long &operator()() { return this->val; }
};
######## call.pxd ########
cdef extern from "call.cpp" nogil:
cppclass wint:
long long val
wint()
wint(long long val)
long long& operator()()
######## call_stack_allocated.pyx ########
from call cimport wint
def test():
cdef wint a = wint(4)
cdef long long b = 3
b = a()
assert b == 4
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