Bug 21638 – std.typecons.RefCounted!(T, RefCountedAutoInitialize.no) should still work when T.this() is annotated with `@disable`
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-02-15T19:52:16Z
Last change time
2021-02-22T20:03:35Z
Keywords
pull
Assigned to
No Owner
Creator
Nathan S.
Comments
Comment #0 by n8sh.secondary — 2021-02-15T19:52:16Z
Sample code:
---
void main()
{
import std.typecons : RefCounted, RefCountedAutoInitialize;
static struct NoDefaultCtor
{
@disable this();
this(int x) { this.x = x; }
int x;
}
auto rc = RefCounted!(NoDefaultCtor, RefCountedAutoInitialize.no)(5);
assert(rc.x == 5);
}
---
Currently fails to compile with:
[...]/src/phobos/std/conv.d(4488): Error: static assert: "Cannot emplace a NoDefaultCtor because NoDefaultCtor.this() is annotated with @disable."
Comment #1 by dlang-bot — 2021-02-15T19:55:03Z
@n8sh created dlang/phobos pull request #7797 "std.typecons.Refcounted!(T, RefCountedAutoInitialize.no) should still work when T.this() is annotated with `@disable`" fixing this issue:
- Fix Issue 21638 - std.typecons.Refcounted!(T, RefCountedAutoInitialize.no) should still work when T.this() is annotated with `@disable`
https://github.com/dlang/phobos/pull/7797
Comment #2 by dlang-bot — 2021-02-22T20:03:35Z
dlang/phobos pull request #7797 "std.typecons.RefCounted!(T, RefCountedAutoInitialize.no) should still work when T.this() is annotated with `@disable`" was merged into master:
- 35035d4cfe239cdbf07b30015fbba143313d75e3 by Nathan Sashihara:
Fix Issue 21638 - std.typecons.RefCounted!(T, RefCountedAutoInitialize.no) should still work when T.this() is annotated with `@disable`
https://github.com/dlang/phobos/pull/7797