Thread overview
[Issue 13890] Comparing arrays within structs results in an assignment.
Dec 24, 2014
Ketmar Dark
Dec 24, 2014
Kenji Hara
Jan 25, 2015
yebblies
Jul 05, 2017
Vladimir Panteleev
December 24, 2014
https://issues.dlang.org/show_bug.cgi?id=13890

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

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

--- Comment #1 from Ketmar Dark <ketmar@ketmar.no-ip.org> ---
can't reproduce on DMD git head, x86. so the bug may be x86_64 specific.

--
December 24, 2014
https://issues.dlang.org/show_bug.cgi?id=13890

--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> ---
The issue status is unintentionally changed by merging the PR: https://github.com/D-Programming-Language/dmd/pull/3885

--
December 25, 2014
https://issues.dlang.org/show_bug.cgi?id=13890

--- Comment #3 from b.j.dejong@hotmail.com ---
Figured out what the actual problem seems to be.

The bug doesn't happen during array comparison but during struct initialisation. All structs apparently get the same array instead of new ones. When changing the array initialisation to the constructor the bug goes away.

--
January 25, 2015
https://issues.dlang.org/show_bug.cgi?id=13890

yebblies <yebblies@gmail.com> changed:

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

--- Comment #4 from yebblies <yebblies@gmail.com> ---
I can't confirm on linux64 either. It looks superficially similar to issue 2947.

--
July 05, 2017
https://issues.dlang.org/show_bug.cgi?id=13890

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dlang-bugzilla@thecybershad
                   |                            |ow.net
         Resolution|---                         |INVALID

--- Comment #5 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
(In reply to b.j.dejong from comment #0)
> struct Bug {
>     float[] elements = new float[4];

This code is invalid - Every instance of the "Bug" type will have its "elements" field will point to the same copy of the array. It should not have compiled. See issue 17604.

--