Closed tchaloupka closed 5 years ago
Here is the test case:
import cerealed; struct Foo { string value; } auto data = Foo("bar").cerealise; auto f1 = data.decerealise!Foo; assert(f1.value == "bar"); //f1.value = f1.value.idup; auto data2 = Foo("baz").cerealise; data[] = data2[]; auto f2 = data.decerealise!Foo; assert(f2.value == "baz"); //f2.value = f2.value.idup; assert(f1.value == "bar");
When string is deserialized it points to the original muttable buffer so when other data come to it, string is modified even though it's immutable.
Here is the test case:
When string is deserialized it points to the original muttable buffer so when other data come to it, string is modified even though it's immutable.