dlang.org icon indicating copy to clipboard operation
dlang.org copied to clipboard

Document no copy construction occurs on struct initialization/`init` assignment

Open dlangBugzillaToGithub opened this issue 12 years ago • 1 comments

Denis Shelomovskii (@denis-sh) reported this on 2013-06-16T01:39:12Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=10371

Description

Documentation must guarantee no copy construction occurs on struct initialization and `init` assignment or usage of any struct with disabled default construction is not guaranteed to compile:
---
struct S
{ @disable this(this); }

void main()
{
    // Copy constructed from temporary?
    S s = S();

    // Copy constructed from `S.init`?
    S s2 = S.init;

    // Assigned from `S.init`?
    s2 = S.init;
}
---

E.g. in C++ one can use `S s(...)` syntax for this purpose.

dlangBugzillaToGithub avatar Jun 16 '13 01:06 dlangBugzillaToGithub

andrej.mitrovich (@AndrejMitrovic) commented on 2014-04-22T23:43:23Z

*** Issue 9002 has been marked as a duplicate of this issue. ***

dlangBugzillaToGithub avatar Apr 22 '14 23:04 dlangBugzillaToGithub