[Issue 12863] Crash in cast_.d on OSX 10.9
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Apr 2 01:47:22 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=12863
Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |verylonglogin.reg at gmail.com
Hardware|x86_64 |All
Resolution|--- |INVALID
OS|Mac OS X |All
--- Comment #1 from Denis Shelomovskij <verylonglogin.reg at gmail.com> ---
`Select` constructor is typesafe variadic function so `projection` array may be
constructed on stack and thus contains garbage after function returns, casting
this garbage to `Node` fails somewhere in D runtime.
To fix the code replace
---
this.projection = projection;
---
with
---
this.projection = projection.dup; // `dup` is added
---
P.S.
One should be aware of typesafe variadic functions danger and carefully read
docs [1].
[1] http://dlang.org/function.html
--
More information about the Digitalmars-d-bugs
mailing list