www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Playing around with aliasthis

reply Rory <rjmcguire gmail.com> writes:
Hi,

I need some help understanding dmd and I'm wondering where I 
should ask.

I have made a multiple aliasthis implementation that currently 
only works for structs. If I try to use a class then the compiler 
segfaults in .
The implementation basically just changes aggregate.aliasthis to 
be aggregate.aliasthis(Type expectedType) and then that function 
picks a matching aliasthis option and returns it.

Thanks,
Rory
Jan 25 2016
parent Rory McGuire via Digitalmars-d <digitalmars-d puremagic.com> writes:
On Tue, Jan 26, 2016 at 8:20 AM, Rory via Digitalmars-d <
digitalmars-d puremagic.com> wrote:

 Hi,

 I need some help understanding dmd and I'm wondering where I should ask.

 I have made a multiple aliasthis implementation that currently only works
 for structs. If I try to use a class then the compiler segfaults in .
 The implementation basically just changes aggregate.aliasthis to be
 aggregate.aliasthis(Type expectedType) and then that function picks a
 matching aliasthis option and returns it.

 Thanks,
 Rory
The segfault was because I forgot to mark one of my new methods as "final", and it was messing with the poffset in baseOf. I think this is relevant to anyone mixing D and C++, not sure if its for everyone because I'm not sure where poffset comes from. Basically if a struct works and a class causes the compiler to segfault in baseOf when compiling your module, its probably this.
Jan 26 2016