www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - RefCounted: conflicting overloads of refCountedPayload()

reply bitwise <bitwise.pvt gmail.com> writes:
I'm still hitting this bug on dmd 2.073.0:
https://issues.dlang.org/show_bug.cgi?id=13009

I'm having trouble creating a minimal repro, but the error is:

Error: std.typecons.RefCounted!(MyPayload, 
cast(RefCountedAutoInitialize)1).RefCounted.refCountedPayload 
called with argument types () matches both:
typecons.d(5198):  std.typecons.RefCounted!(MyPayload, 
cast(RefCountedAutoInitialize)1).RefCounted.refCountedPayload()
and:
typecons.d(5190):  std.typecons.RefCounted!(MyPayload, 
cast(RefCountedAutoInitialize)1).RefCounted.refCountedPayload()


Can't the second overload just be put in an 'else' for the 
'static if'?:

https://github.com/dlang/phobos/blob/db204e0f8a4cc2d5235d95b5fb10dfcc9ea35048/std/typecons.d#L5296-L5312
Jan 28 2017
next sibling parent reply bitwise <bitwise.pvt gmail.com> writes:
On Saturday, 28 January 2017 at 20:14:29 UTC, bitwise wrote:
 I'm having trouble creating a minimal repro, but the error is:
Managed to get a repro working. Commenting out the alias 'X' makes the error go away. If someone can confirm my sanity, I'll file a bug for this. --- struct S { struct Payload { int[] data; } RefCounted!(Payload, RefCountedAutoInitialize.yes) payload; alias X = typeof(payload.data[0]); } int main(string[] argv) { return 0; } main.d(196): Error: std.typecons.RefCounted!(Payload, cast(RefCountedAutoInitialize)1).RefCounted.refCountedPayload called with argument types () matches both: typecons.d(5241): std.typecons.RefCounted!(Payload, cast(RefCountedAutoInitialize)1).RefCounted.refCountedPayload() and: typecons.d(5233): std.typecons.RefCounted!(Payload, cast(RefCountedAutoInitialize)1).RefCounted.refCountedPayload()
Jan 28 2017
parent reply Dsby <dushibaiyu yahoo.com> writes:
On Saturday, 28 January 2017 at 21:24:11 UTC, bitwise wrote:
 On Saturday, 28 January 2017 at 20:14:29 UTC, bitwise wrote:
 [...]
Managed to get a repro working. Commenting out the alias 'X' makes the error go away. If someone can confirm my sanity, I'll file a bug for this. [...]
I think the smart ref is better: https://github.com/huntlabs/SmartRef
Jan 28 2017
parent bitwise <bitwise.pvt gmail.com> writes:
On Sunday, 29 January 2017 at 03:12:52 UTC, Dsby wrote:
 I think the smart ref is better: 
 https://github.com/huntlabs/SmartRef
Pretty decent implementation. It's a shame that things like "make_shared_from_this" aren't properly possible in D. I think it's a small price to pay for not having to deal with multiple inheritance though. I considered writing my own ref counted pointers as well. Among those considerations were the thought that I should make it "make_shared" by default, and leave wrapping windows HANDLE's and whatnot to a separate primitive. This obviates the need for the second pointer since the ref count _is_ the payload. Weak pointers in D would be nice too, but I assume it won't be necessary if D ends up getting built in ARC. Also, I don't have any use for them right now.
Jan 28 2017
prev sibling parent bitwise <bitwise.pvt gmail.com> writes:
On Saturday, 28 January 2017 at 20:14:29 UTC, bitwise wrote:
 I'm still hitting this bug on dmd 2.073.0:
 https://issues.dlang.org/show_bug.cgi?id=13009
Just reopened the old bug. Good talk guys ;)
Jan 29 2017