Should it be a compile time error?
dennis luehring
dl.soluz at gmx.net
Wed Jun 19 06:06:55 PDT 2013
Am 19.06.2013 13:40, schrieb Iain Buclaw:
> On Wednesday, 19 June 2013 at 11:33:43 UTC, deed wrote:
>> The following compiles and crashes with DMD 2.063.
>> Should this be a compile time error?
>>
>>
>> class A
>> {
>> int _var;
>>
>
> /* SNIP */
>
>> int var() @property
>> {
>> return var;
>> }
>
> Isn't the problem in this property function? (Shouldn't it
> return _var :o)
that isn't the problem - D allows assignment to an read property - and
there is no write property around, so it should be an compiletime error
i should compile only if the missing write property is available - or?
@property int var(int value) { return _var = value; }
More information about the Digitalmars-d-learn
mailing list