Commit 16ad9e21 authored by Ian Henriksen's avatar Ian Henriksen

Don't error out when non-const value is passed as a const specified

parameter to a function. When function arguments are marked as const,
this means that the function should not modify them, not that
non-const arguments are not allowed.
This also fixes a test that began failing because this change resulted
in a slightly different error message when conversion to a const
qualified argument is not possible.
parent 812cd069
......@@ -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'
"""
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