Thread overview
[Issue 17258] Pass by name doesn't work reliably and can sometimes lead to memory corruption
Mar 15, 2017
ZombineDev
Mar 15, 2017
ZombineDev
Mar 15, 2017
ag0aep6g@gmail.com
Mar 16, 2017
Ketmar Dark
May 25, 2019
Dlang Bot
March 15, 2017
https://issues.dlang.org/show_bug.cgi?id=17258

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code

--
March 15, 2017
https://issues.dlang.org/show_bug.cgi?id=17258

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |petar.p.kirov@gmail.com

--
March 15, 2017
https://issues.dlang.org/show_bug.cgi?id=17258

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g@gmail.com

--- Comment #1 from ag0aep6g@gmail.com ---
Looks like the compiler thinks `var` is a field. Writing to `v.var` then stomps over anything that's actually there.

----
struct ByName3(alias Var)
{
    alias var = Var;
    ubyte value = 1;
}

void main()
{
    ushort x;
    ByName3!x v;
    ubyte w = 2;

    v.var = 0xAA_BB; /* stomps over v.value and w */

    import std.stdio;
    writefln("%X", v.value); /* prints "BB", should be 1 */
    writefln("%X", w); /* prints "AA", should be 2 */
}
----

--
March 16, 2017
https://issues.dlang.org/show_bug.cgi?id=17258

Ketmar Dark <ketmar@ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar@ketmar.no-ip.org

--
May 25, 2019
https://issues.dlang.org/show_bug.cgi?id=17258

Suleyman Sahmi (سليمان السهمي) <sahmi.soulaimane@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sahmi.soulaimane@gmail.com
           Assignee|nobody@puremagic.com        |sahmi.soulaimane@gmail.com

--
May 25, 2019
https://issues.dlang.org/show_bug.cgi?id=17258

Dlang Bot <dlang-bot@dlang.rocks> changed:

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

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #9884 "Fix issue 17258 - Alias parameter wrongly accessed as a field" was merged into stable:

- a21e8dfd606ae94b104b4a1a81b2c31476cf13ca by سليمان السهمي  (Suleyman Sahmi):
  Fix issue 17258 - Alias parameter wrongly accessed as a field

https://github.com/dlang/dmd/pull/9884

--