Commit db4e3903 authored by Xavier Thompson's avatar Xavier Thompson

Cast NULL argument for optional parameters to avoid generating ambiguous calls

parent 670ea033
...@@ -6066,7 +6066,12 @@ class SimpleCallNode(CallNode): ...@@ -6066,7 +6066,12 @@ class SimpleCallNode(CallNode):
if func_type.optional_arg_count: if func_type.optional_arg_count:
if expected_nargs == actual_nargs: if expected_nargs == actual_nargs:
optional_args = 'NULL' # Cast NULL to optional struct type to avoid ambiguous calls
opt_struct_type = func_type.op_arg_struct.base_type
if opt_struct_type.typedef_flag:
optional_args = '(%s *)NULL' % opt_struct_type.cname
else:
optional_args = '(%s %s *)NULL' % (opt_struct_type.kind, opt_struct_type.cname)
else: else:
optional_args = "&%s" % self.opt_arg_struct optional_args = "&%s" % self.opt_arg_struct
arg_list_code.append(optional_args) arg_list_code.append(optional_args)
......
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