Commit b5955fdf authored by Robert Bradshaw's avatar Robert Bradshaw

Merge pull request #495 from insertinterestingnamehere/const_args

Don't error out when non-const value is passed as const function parameter
parents d59968c0 e1fd7949
......@@ -5052,6 +5052,8 @@ class SimpleCallNode(CallNode):
for i in range(min(max_nargs, actual_nargs)):
formal_arg = func_type.args[i]
formal_type = formal_arg.type
if formal_type.is_const:
formal_type = formal_type.const_base_type
arg = args[i].coerce_to(formal_type, env)
if formal_arg.not_none:
# C methods must do the None checks at *call* time
......
......@@ -19,5 +19,5 @@ cdef long long e = constructor_overload(17)
_ERRORS = u"""
18:40: Cannot assign type 'long' to 'const wrapped_int'
18:40: Cannot assign type 'long' to 'wrapped_int'
"""
cdef double f(const double a, const double b, const double c):
return a + b - c
def test_non_const_as_const_arg():
"""
>>> test_non_const_as_const_arg()
1.0
"""
cdef double a = 1., b = 1., c = 1.
return f(a, b, c)
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