Detect the bug in the following code

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 15 12:39:03 PDT 2015


On Wednesday, 15 April 2015 at 18:25:33 UTC, w0rp wrote:
> On Wednesday, 15 April 2015 at 15:17:32 UTC, Steven 
> Schveighoffer wrote:
>> On 4/15/15 10:44 AM, Idan Arye wrote:
>>> import std.stdio;
>>>
>>> struct Foo {
>>>    bool registered = false;
>>>
>>>    void register(int x) {
>>>        writeln("Registering ", x);
>>>        register = true;
>>>    }
>>> }
>>>
>>> void main() {
>>>    Foo foo;
>>>    foo.register(10);
>>> }
>>
>> Easy, the bug is in DMD improperly accepting property 
>> assignment without @property annotation :P
>>
>> -Steve
>
> Yep. Push patches for DIP23. Get it in the compiler already. 
> Make only x.foo legal without @property.

See 
http://forum.dlang.org/post/kesbfurmakedjqcqljzg@forum.dlang.org


More information about the Digitalmars-d mailing list