Bug 22510 – Structs with copy constructor can not be heap allocated with default constructor

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-11-14T11:12:10Z
Last change time
2021-11-18T09:20:19Z
Keywords
pull
Assigned to
No Owner
Creator
omerfirmak

Comments

Comment #0 by omerfirmak — 2021-11-14T11:12:10Z
import std; struct S { int b; @disable this(this); this (scope ref inout S) inout { this.b = b; } } void main() { auto scoped_s = S(4); auto heap_s = new S(42); } ----------------------------------- `auto heap_s = new S(42)` line fails with the following error; onlineapp.d(17): Error: copy constructor `onlineapp.S.this(ref inout(S) _param_0) inout` is not callable using argument types `(int)` onlineapp.d(17): cannot pass rvalue argument `42` of type `int` to parameter `ref inout(S) _param_0`
Comment #1 by dlang-bot — 2021-11-14T11:51:28Z
@omerfirmak created dlang/phobos pull request #8315 "Add explicit default ctor for DList.PayNode" mentioning this issue: - Add explicit default ctor for DList.PayNode Worksaround Issue 22510 (https://issues.dlang.org/show_bug.cgi?id=22510) which prevented us from using structs with explicit copy ctors with DList. https://github.com/dlang/phobos/pull/8315
Comment #2 by dlang-bot — 2021-11-14T13:14:27Z
dlang/phobos pull request #8315 "Add explicit default ctor for DList.PayNode" was merged into master: - 61d3fe32930e5457c8665b76d0e826002c3d2dfa by Ömer Faruk IRMAK: Add explicit default ctor for DList.PayNode Worksaround Issue 22510 (https://issues.dlang.org/show_bug.cgi?id=22510) which prevented us from using structs with explicit copy ctors with DList. https://github.com/dlang/phobos/pull/8315
Comment #3 by dlang-bot — 2021-11-15T08:35:53Z
@omerfirmak created dlang/phobos pull request #8318 "Merge PR #8315 & #8316 in to `stable`" mentioning this issue: - Add explicit default ctor for DList.PayNode Worksaround Issue 22510 (https://issues.dlang.org/show_bug.cgi?id=22510) which prevented us from using structs with explicit copy ctors with DList. https://github.com/dlang/phobos/pull/8318
Comment #4 by dlang-bot — 2021-11-15T09:05:26Z
@RazvanN7 created dlang/dmd pull request #13306 "Fix Issue 22510 - Structs with copy constructor can not be heap allocated with default constructor" fixing this issue: - Fix Issue 22510 - Structs with copy constructor can not be heap allocated with default constructor https://github.com/dlang/dmd/pull/13306
Comment #5 by dlang-bot — 2021-11-15T09:20:11Z
dlang/phobos pull request #8318 "Merge PR #8315 & #8316 in to `stable`" was merged into stable: - bd090534a41834bb4efd0fc8afb7506bb2d87f18 by Ömer Faruk IRMAK: Add explicit default ctor for DList.PayNode Worksaround Issue 22510 (https://issues.dlang.org/show_bug.cgi?id=22510) which prevented us from using structs with explicit copy ctors with DList. https://github.com/dlang/phobos/pull/8318
Comment #6 by dlang-bot — 2021-11-17T09:18:47Z
@RazvanN7 created dlang/dmd pull request #13314 "Fix Issue 22510 - Structs with copy constructor can not be heap allocated with default constructor" fixing this issue: - Fix Issue 22510 - Structs with copy constructor can not be heap allocated with default constructor https://github.com/dlang/dmd/pull/13314
Comment #7 by dlang-bot — 2021-11-18T09:20:19Z
dlang/dmd pull request #13314 "Fix Issue 22510 - Structs with copy constructor can not be heap allocated with default constructor" was merged into master: - 468f4eab75e48c147b8e9f910944abc4fb47d899 by RazvanN7: Fix Issue 22510 - Structs with copy constructor can not be heap allocated with default constructor https://github.com/dlang/dmd/pull/13314