hasDataMember and mixin inconsistency

Artur Skawina art.08.09 at gmail.com
Sun Jan 27 04:14:34 PST 2013


On 01/27/13 12:47, Olivier Grant wrote:
> On Sunday, 27 January 2013 at 09:49:33 UTC, Philippe Sigaud wrote:
>> You cannot write to .init, it's not a member. It's a built-in
>> property, like .sizeof or .offsetof.
> 
> Makes sense.

It does, but apparently the compiler disagrees. 

>>> 2) Is there a better way to check for the existence of a data member ?
>>
>> If by data member, you mean some symbol that can be read and written
>> to, then I'd test just that. See the string mixin before: it tests for
>> existence, reading and writing.
> 
> Could this be a compiler bug by any chance? It seems really weird

Yes, it's a bug. Assignments to .init do not make sense and shouldn't be
allowed. I just tried, and the old gdc version i have here doesn't flag
them as errors (but did segfault after processing one ;) ).

artur


More information about the Digitalmars-d-learn mailing list