Commit 0a0e72a7 authored by Robert Bradshaw's avatar Robert Bradshaw

Compiler crash on calling non-entry function.

parent a46f5295
...@@ -2601,6 +2601,13 @@ class SimpleCallNode(CallNode): ...@@ -2601,6 +2601,13 @@ class SimpleCallNode(CallNode):
self.function.entry = entry self.function.entry = entry
self.function.type = entry.type self.function.type = entry.type
func_type = self.function_type() func_type = self.function_type()
else:
func_type = self.function_type()
if not func_type.is_cfunction:
error(self.pos, "Calling non-function type '%s'" % func_type)
self.type = PyrexTypes.error_type
self.result_code = "<error>"
return
# Check no. of args # Check no. of args
max_nargs = len(func_type.args) max_nargs = len(func_type.args)
expected_nargs = max_nargs - func_type.optional_arg_count expected_nargs = max_nargs - func_type.optional_arg_count
......
...@@ -8,7 +8,13 @@ ctypedef struct s: # FIXME: this might be worth an error ... ...@@ -8,7 +8,13 @@ ctypedef struct s: # FIXME: this might be worth an error ...
int x int x
s() s()
cdef int x():
return 0
x()()
_ERRORS = u""" _ERRORS = u"""
2:1: Calling non-function type 'int' 2:1: Calling non-function type 'int'
5:1: Calling non-function type 'float' 5:1: Calling non-function type 'float'
14:3: Calling non-function type 'int'
""" """
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