[Issue 5690] Struct const member makes struct const

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 24 05:20:30 PST 2012


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


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2012-01-24 05:20:27 PST ---
(In reply to comment #2)
> Right, this is not a compiler bug.

No, this is a compiler bug.

(In reply to comment #1)
> It only makes sense that it should make it const - to reassign the struct would
> violate the constancy of the const member.

A returned value from f() is *mutable* object, so to reassign the part of it is
still valid.

  f().i = 10;  // field i is mutable so this code should compile.

This issue is a dup of bug 6366, that has more better summary "Issue 6336 -
Can't return ref T where T has const/immutable members".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list