Bug 20375 – std.typecons.RefCounted does not work with checkaction-context
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-11-09T22:33:55Z
Last change time
2020-02-13T23:27:05Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2019-11-09T22:33:55Z
Using checkation=context results in another temporary which gets destroyed but not constructed by any declared constructor.
Reduced test case:
struct RefCounted
{
static int instances;
this(bool data)
{
instances++;
}
this(this)
{
instances++;
}
~this()
{
instances--;
}
bool opEquals(RefCounted)
{
return true;
}
}
{
auto a = RefCounted(true);
assert(a == a);
}
assert(RefCounted.instances == 0);
Comment #1 by dlang-bot — 2019-11-09T23:19:55Z
@MoonlightSentinel created dlang/dmd pull request #10550 "Fix Issue 20375 - RefCounted does not work with checkaction-context" fixing this issue:
- Fix Issue 20375 - std.typecons.RefCounted does not work with checkaction-context
https://github.com/dlang/dmd/pull/10550
Comment #2 by dlang-bot — 2020-02-13T23:27:05Z
dlang/dmd pull request #10550 "Fix Issue 20375 - RefCounted does not work with checkaction-context" was merged into master:
- 32485b35c929ea49a7e0785b83297669ce81cde9 by MoonlightSentinel:
Fix Issue 20375 - std.typecons.RefCounted does not work with checkaction-context
https://github.com/dlang/dmd/pull/10550