[Issue 15542] pure function with no argument returning different values (with void-initialized static array)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 23 16:43:15 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=15542

ag0aep6g at gmail.com changed:

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

--- Comment #4 from ag0aep6g at gmail.com ---
(In reply to Marc Schütz from comment #1)
> Note how it says "undefined program behavior", not even "undefined value".
> So technically, the current behaviour is within the spec.

(In reply to Jonathan M Davis from comment #3)
> You'd basically have to force all pure functions to be @safe if you wanted
> to avoid this problem.

Note that the test code still compiles even when you add `@safe`. Void
initialization of value types is considered `@safe`.

--


More information about the Digitalmars-d-bugs mailing list