[Issue 2625] Creating new struct with literal bypasses immutability of members if struct is in array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 2 11:12:45 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2625


smjg at iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg at iname.com




------- Comment #3 from smjg at iname.com  2009-04-02 13:12 -------
(In reply to comment #2)
> According to specs http://digitalmars.com/d/2.0/struct.html works() is correct.

Where on that page is the issue addressed?

> I think, broken() is correct, since invariant data can be referenced directly,
> so it's incorrect for it to change in time.

I'm a little puzzled by your use of "correct".  By my calculation, both are
incorrect - the difference is whether the compiler correctly diagnoses this
fact.

It makes no sense to reassign a struct that has immutable members by any means.
 In fact, a struct with at least one immutable member should be treated as
itself immutable for most purposes.

I'll look into it a bit more when I've time....


-- 



More information about the Digitalmars-d-bugs mailing list