April 22, 2018
https://issues.dlang.org/show_bug.cgi?id=15869

--- Comment #10 from Walter Bright <bugzilla@digitalmars.com> ---
https://github.com/dlang/dmd/pull/8200

--
April 22, 2018
https://issues.dlang.org/show_bug.cgi?id=15869

--- Comment #11 from Ketmar Dark <ketmar@ketmar.no-ip.org> ---
ahem. i was under impression that "constructors" in D are actually "post-initializers". i.e. that object must be fully initialized with default values before calling ctor, and can't have "unconstructed" anything (unless it has `=void` as default value, of course). that is, in the given case, compiler should detect that `a` is actually used, and fully initialize it before calling ctor of `XX`. or generate error on *any* "use-before-init" access, including things like "v++" and such.

that is, it looks to me that "pragmatic solution" is not really solving anything in this case: it just hacks around one very specific case, and in the same time makes D behavior even more unintuitive.

--
April 22, 2018
https://issues.dlang.org/show_bug.cgi?id=15869

--- Comment #12 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Walter Bright from comment #9)
> The most pragmatic solution is to not allow taking a reference to an unconstructed field.

That proved unworkable.

One that does work is to regard taking the address of a field as "initializing" it. Then,

    a = clobber(&a);

is regarded as an assignment, rather than a construction, and the RVO is set to a temporary, not `a`.

Nothing else I could think of was palatable.

--
May 14, 2018
https://issues.dlang.org/show_bug.cgi?id=15869

--- Comment #13 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/0ba1f25c99bfd6e02b64b3b283540ed74e97fca5 fix Issue 15869 - RVO can overwrite argument

https://github.com/dlang/dmd/commit/68eb9d341ccd0b7872ce719df07da268398dc3aa Merge pull request #8200 from WalterBright/fix15869

fix Issue 15869 - RVO can overwrite argument
merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>

--
May 14, 2018
https://issues.dlang.org/show_bug.cgi?id=15869

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--
1 2
Next ›   Last »