[Issue 9665] Structure constant members can not be initialized if have opAssign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 9 10:29:13 PST 2013


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



--- Comment #7 from Kenji Hara <k.hara.pg at gmail.com> 2013-03-09 10:29:11 PST ---
(In reply to comment #5)
[snip]

To enforce breaking type system by language users is not good at all.

When talking about language semantics, unsafe operation like cast must not
appear. Language user can break type system explicitly, but compiler must not
do it.

(In reply to comment #6)
> Is there any way to break const correctness if opAssign is pure?

'pure' attribute does not affect constancy.

> If not, then changes should be allowed for pure opAssign (e.g. with implicit
> cast field to mutable).

opAssign should modify its 'this' object for the meaningful operation, but
mutable method cannot call on non-const object, even inside constructor. So
this problem is unfixable.

-- 
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