clang error with default nil parameter #4328

Closed
zeitbit opened this Issue Jun 13, 2016 · 0 comments

Projects

None yet

2 participants

@zeitbit
zeitbit commented Jun 13, 2016 edited

This is a minimum example that generates the problem:

type
    foo[T] = object
        z: T

proc test[T](x: foo[T], p: proc(a: T) = nil) =
    discard

var d: foo[int]
d.test()  # <- param omitted

The clang compiler outputs:

exit code: 256
error: passing 'void *' to parameter of incompatible type 'TY94039' test_94033_1469640583(d_94030_1469640583, NIM_NIL);
note: passing argument to parameter 'p0' here
N_NIMCALL(void, test_94033_1469640583)(dummyHEX3Aobjecttype94027
x0, TY94039 p0) {
*

If you don't omit the param in d.test() it works, for example: d.text(nil)

I tested this only in Mac and with Nim versions 0.14 and 0.14.2.

@Araq Araq added a commit that closed this issue Jul 19, 2016
@Araq Araq fixes #4328 dc4b2c9
@Araq Araq closed this in dc4b2c9 Jul 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment