[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
Sat Apr 4 06:51:13 PDT 2009


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





------- Comment #6 from smjg at iname.com  2009-04-04 08:51 -------
(In reply to comment #5)
> (In reply to comment #3)
>> Where on that page is the issue addressed?
> 
> see "Const and Invariant Structs"

That bit talks about the whole struct being declared const.  But 
you're right, it doesn't seem to make sense.  It would appear that that section
had been blindly c&p'd from the page about classes, except that that page now
doesn't go into as much detail on this matter.

>>> 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".
> 
> I meant, it's correct that error is given for broken().

To me, that's the compiler being correct - quite a different thing from the
code being correct.


-- 



More information about the Digitalmars-d-bugs mailing list