Bug 2948 – Array literal changeable if part of class.

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-05-07T01:35:00Z
Last change time
2015-06-09T01:26:26Z
Assigned to
bugzilla
Creator
georg

Comments

Comment #0 by georg — 2009-05-07T01:35:37Z
import std.stdio; class A { int[] c = [3,3]; } void main() { int[] a = [2,2]; int[] b = [2,2]; a[0] = 33; assert(b[0] == 2); // success A ca = new A; A cb = new A; ca.c[0] = 44; assert(cb.c[0] == 3); // failure: value is 44 }
Comment #1 by gide — 2009-05-07T03:32:13Z
*** This bug has been marked as a duplicate of 2947 ***