D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 22511 - Nullable is not copyable when templated type has elaborate copy ctor
Summary: Nullable is not copyable when templated type has elaborate copy ctor
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 enhancement
Assignee: No Owner
URL:
Keywords: pull
: 21397 (view as issue list)
Depends on:
Blocks:
 
Reported: 2021-11-14 14:17 UTC by omerfirmak
Modified: 2022-10-24 18:07 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description omerfirmak 2021-11-14 14:17:48 UTC
import std;

struct S
{
	int b;
    
    this (int b)
    {
    	this.b = b;
    }
    
    @disable this(this);
    this (scope ref inout S) inout
    {
    	this.b = b;
    }
} 

void main()
{
	Nullable!S _s;
	_s = S(3);
}

-----------------

fails with 

/home/omer/dlang/ldc-1.28.0/bin/../import/std/typecons.d(3031): Error: Generating an `inout` copy constructor for `struct std.typecons.Nullable!(S).Nullable` failed, therefore instances of it are uncopyable
newtest.d(22): Error: template instance `std.typecons.Nullable!(S).Nullable.opAssign!()` error instantiating
Comment 1 Dlang Bot 2021-11-14 14:39:56 UTC
@omerfirmak created dlang/phobos pull request #8316 "Fix Issue 22511 - Add explicit copy ctor for Nullable" fixing this issue:

- Fix Issue 22511 - Add explicit copy ctor for Nullable

https://github.com/dlang/phobos/pull/8316
Comment 2 Dlang Bot 2021-11-15 08:35:54 UTC
@omerfirmak created dlang/phobos pull request #8318 "Merge PR #8315 & #8316 in to `stable`" fixing this issue:

- Fix Issue 22511 - Add explicit copy ctor for Nullable

https://github.com/dlang/phobos/pull/8318
Comment 3 Dlang Bot 2021-11-15 09:13:54 UTC
dlang/phobos pull request #8316 "Fix Issue 22511 - Add explicit copy ctor for Nullable" was merged into master:

- b141ae469baf5b496ace0e056893b48c371efc72 by Ömer Faruk IRMAK:
  Fix Issue 22511 - Add explicit copy ctor for Nullable

https://github.com/dlang/phobos/pull/8316
Comment 4 Dlang Bot 2021-11-15 09:20:13 UTC
dlang/phobos pull request #8318 "Merge PR #8315 & #8316 in to `stable`" was merged into stable:

- e84de9faaefc55d09e9f126615e97cf5a219d2c2 by Ömer Faruk IRMAK:
  Fix Issue 22511 - Add explicit copy ctor for Nullable

https://github.com/dlang/phobos/pull/8318
Comment 5 Mathias LANG 2022-10-24 18:07:41 UTC
*** Issue 21397 has been marked as a duplicate of this issue. ***