https://issues.dlang.org/show_bug.cgi?id=16095

          Issue ID: 16095
           Summary: a delegate can mutate immutable data
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

the following code shows how one could mutate an immutable object:

      struct Foo {
         bool flag;
         void flip() {
            flag = true;
         }
      }

      immutable Foo foo;
      (&foo.flip)();
      assert(!foo.flag); //fails

--

Reply via email to