On Monday, 1 June 2015 at 16:52:30 UTC, Robert M. Münch wrote:
I'm a bit confused... I have the following class:
class foo : superFoo {
aFoo spec;
aFoo lvars;
aFoo bdy;
override string toString(){
if(spec.isEmpty() && lvars.isEmpty()){
return "does spec";
}
if(lvars.isEmpty()){
return "funct spec";
}
return "function spec";
}
}
The thing is, as soon as one if the IFs is true and the return
statement is executed I get a seg-fault: 11
If I comment the IFs it works. But I can't see any differences
in returning from inside the if vs. the return at the end of
the function.
Any idea?
Chances are very good that it's the code within the if statement,
classes are null by default, you're checking if null isEmpty,
thus getting a segfault.