D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21638 - std.typecons.RefCounted!(T, RefCountedAutoInitialize.no) should still work when T.this() is annotated with `@disable`
Summary: std.typecons.RefCounted!(T, RefCountedAutoInitialize.no) should still work wh...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2021-02-15 19:52 UTC by Nathan S.
Modified: 2021-02-22 20:03 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nathan S. 2021-02-15 19:52:16 UTC
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 Dlang Bot 2021-02-15 19:55:03 UTC
@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 Dlang Bot 2021-02-22 20:03:35 UTC
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