Detect the bug in the following code

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 15 08:17:32 PDT 2015


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


More information about the Digitalmars-d mailing list