immutable/mutable aliasing

Jet via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 3 13:43:32 PDT 2014


void foo(immutable int* x, int* y) {
  bar(*x); // bar(3)
  *y = 4;  // undefined behavior
  bar(*x); // bar(??)
}
...
int i = 3;
foo(cast(immutable)&i, &i);
----------------------------------
In the 2.065 version, I can compile. But that is not in the 
documentation.


More information about the Digitalmars-d-learn mailing list