[Issue 3449] const and invariant struct members do not behave according to spec

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 23 04:29:02 PST 2012


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



--- Comment #11 from Kenji Hara <k.hara.pg at gmail.com> 2012-01-23 04:28:52 PST ---
(In reply to comment #9)
> This is as designed. A const field without an initializer can be initialized by
> a constructor. A const field with an initializer does not need any per-instance
> storage, and becomes a static member.

> It is not a bug, it is as designed. (const in D and C are different, and
> conflating the two will cause problems anyway)

(In reply to comment #10)
> Taking the address should work. Compiler bug, not a spec issue.

I think that  the *implicit static* variable is the worst specification in D.
'const/immutable(not modifiable)' and 'static(not per-instance)' is definitely
orthogonal concepts, but in your argument, they are scary mixed.

So, if we want to need static variable, language *must* require 'static'
storage class for the purpose. Otherwise, it will force us a big (and
meaningless) leap of imaging.

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