https://issues.dlang.org/show_bug.cgi?id=15542
Steven Schveighoffer <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |[email protected] Resolution|--- |INVALID --- Comment #6 from Steven Schveighoffer <[email protected]> --- (In reply to Jonathan M Davis from comment #5) > (In reply to ag0aep6g from comment #4) > > Note that the test code still compiles even when you add `@safe`. Void > > initialization of value types is considered `@safe`. > > Hmmm. I'm inclined to think that that's a bug, but I suppose that it depends > on what types it lets you void initialize. I guess that if it's just ints > and floats and whatnot in the struct, then that doesn't actually pose a > memory safety problem and wouldn't need to be marked @system, but it still > seems wrong. That particular case is not a bug. It's perfectly memory safe to look at/use your own stack frame without initialization, as long as data doesn't contain a reference. > Either way, I think that it's pretty clear that you're dealing with > undefined behavior if you use a void-initialized object before giving it a > proper value, and I don't see any reason to treat pure as special in that > regard. Agree. This is not a bug, just bad code. --
