Bug 8591 – typecons.RefCounted.refCountedPayload should be nothrow
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-08-26T10:51:00Z
Last change time
2012-09-02T15:23:51Z
Assigned to
nobody
Creator
monarchdodra
Comments
Comment #0 by monarchdodra — 2012-08-26T10:51:04Z
When autoInit == RefCountedAutoInitialize.no, then:
refCountedPayload() (and "alias refCountedPayload this") should be nothrow.
This can be fixed by declaring two different functions in a static if bloc... but this may break the auto doc?
Fix is in pull request 736
https://github.com/D-Programming-Language/phobos/pull/736
Comment #1 by issues.dlang — 2012-08-26T11:01:30Z
Marking it as nothrow should be completely unnecessary. The function is templated. nothrow should be inferred. And having to duplicate the function to have a nothrow and non-nothrow version is definitely undesirable.
However, attribute inferrence seems to be very broken right now ( bug# 8504 ), so it wouldn't surprise me in the least if it's not being inferred properly in this case. Attribute inferrence seems to work _sometimes_, but I have yet to figure out under what conditions it does. It's _supposed_ to be inferred for all templated functions, delegates which are explicitly typed, and lambdas, but it only works in a fraction of those circumstances.
Comment #2 by monarchdodra — 2012-08-27T06:36:37Z
I didn't know that nothrow could be inferred.
Also, I completely agree that duplicating the function is, at best, un-desirable.
Yet the inference doesn't wor;: However, I am not calling "refCountedPayload" directly, but the alias "alias refCountedPayload this". Maybe that is the reason? Or not, I just read #8504.
Anyways, it is preventing me from marking other functions as unconditionally nothrow.
I think that in the long run, it is better to have a single workaround, which can be centrally fixed later, rather than having a bunch of functions work around it, potentially never fixing some of those workaround.
Comment #3 by github-bugzilla — 2012-09-02T10:29:54Z