import std.stdio;
struct Y {
private immutable(int)[] _data;
}
struct CFS {
double x = 5;
Y growth;
}
void main() {
auto s = CFS(1.0); // crash
//auto s = CFS(1, Y()); // crash
//auto s = CFS(1, Y([])); // works
writeln(s);
}
If x is an int there is no problem.
If s is not accessed there is no problem, so it dies in the writeln call.
Comment #1 by mk — 2013-11-04T13:11:15Z
Can't reproduce both on Linux and Windows x86.
Comment #2 by burg.basile — 2013-11-04T15:09:34Z
import std.stdio;
struct Y {
private
immutable(int)[] _data;
immutable(int)[] _data2;
}
struct CFS {
double x = 5;
Y growth;
}
void main() {
auto s = CFS(1.0);
writeln(s);
}
runs.
It seems to be more related to the the "private" token.
Comment #3 by burg.basile — 2013-11-04T15:29:24Z
(In reply to comment #2)
> import std.stdio;
>
> struct Y {
> private:
> immutable(int)[] _data;
> immutable(int)[] _data2;
> }
>
> struct CFS {
> double x = 5;
> Y growth;
> }
>
> void main() {
> auto s = CFS(1.0);
> writeln(s);
> }
>
> runs.
>
> It seems to be more related to the the "private" token.
EDIT:
BTW either with private: or private{*/two or more declarations/*}
Comment #4 by k.hara.pg — 2013-11-04T18:32:33Z
http://forum.dlang.org/post/[email protected]
> > It doesn't happen with -O, or when compiled with LDC or GDC.
>
> And it doesn't happen when building with -m32 (I'm on x86_64
> linux).
Comment #5 by robert.schadek — 2024-12-13T18:13:40Z