Sean Eskapp napisał(a):
I had some code that was segfaulting, so I rewrote the basic idea as a
fibonacci function, and lo and behold, it still segfaults. Why, and how
to fix?
This looks fishy:
class Fib
{
private const Fib* left, right;
...
this(in Fib left, in Fib right)
{
this.left = &left;
this.right = &right;
}
Are you sure you want a pointer to class? Classes have reference semantics
in D (like Java). Structs are value types, though. Anyway, it looks like
the ctor takes the address of the reference placed on the stack.
--
Tomek