January 23, 2008 [Issue 1801] New: Const structs should be assignable to non-const variables unless they contain references | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1801 Summary: Const structs should be assignable to non-const variables unless they contain references Product: D Version: 2.010 Platform: PC OS/Version: All Status: NEW Keywords: rejects-valid, spec Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: ludwig@informatik.uni-luebeck.de For structs not containing any reference values (like pointers, class references, arrays etc.) and have not fields which are not assignable for this reason (structs/unions with references). // should be allowed, pure copy: struct S { int x; } const S s_const = {0}; S s_mutable = s_const; // currently not allowed On a related note, initialization of constant variables should be possible, even if the source value is constant: struct S1 { int x; } struct S2 { S1 s1; } const S1 s1_const = {0}; const S2 s2_const = {s1_const}; // currently not allowed -- |
March 07, 2008 [Issue 1801] Const structs should be assignable to non-const variables unless they contain references | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1801 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from bugzilla@digitalmars.com 2008-03-07 00:23 ------- Fixed dmd 2.012 -- |
Copyright © 1999-2021 by the D Language Foundation