https://issues.dlang.org/show_bug.cgi?id=17504
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |[email protected] Resolution|--- |INVALID --- Comment #1 from [email protected] --- (In reply to Marco de Wild from comment #0) > this(MyType[] objs...) > { > _objs = objs; > } That's invalid code. The elements of `objs` are on the stack. `objs` is only valid during the constructor call. Later, `_objs` will contain garbage pointers. Dereferencing them then leads to a segfault. The spec says: "An implementation may construct the object or array instance on the stack. Therefore, it is an error to refer to that instance after the variadic function has returned" - https://dlang.org/spec/function.html#typesafe_variadic_functions I'm closing this as invalid. Just reopen if I'm missing something. However, the code should be rejected when you make the constructor `@safe`. It isn't. There's already an open issue for that: issue 5212. --
