Why does this simple program segfault?

BCS ao at pathlink.com
Tue Aug 14 13:50:33 PDT 2007


Reply to convert,

> Hi,
> 
> I wrote this very simple class, but the call to fun.testIt()
> segfaults.
> If I put the function outside of the class it works just fine.
> What am I missing?
> I have tried this with dmd v1.015 and the tango dmd v1.018, same
> thing.
> Thank you very much.
> 
> -------------------
> import std.stdio;
> class Tester
> {
> void testIt() {}
> }
> void main()
> {
> Tester fun;
> fun.testIt();
> writefln("I made it!");
> }

you don't new the Tester

> Tester fun = new Tester();




More information about the Digitalmars-d-learn mailing list