[Issue 4397] const/CTFE does not work
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 28 23:01:39 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4397
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|wrong-code |performance
--- Comment #9 from Don <clugdbug at yahoo.com.au> 2010-07-28 23:01:36 PDT ---
(In reply to comment #8)
> Well... there can be a problem with immutable literals because immutability is
> transitive... hmm...
> Even if literals aren't immutable, compiler can still catch assignment of
> literal to mutable array and report error.
But it is EXPLICITLY LEGAL to assign a literal to a mutable array. There is an
invisible dup by design. I don't like this, I argued strongly against it, but
it's in there. This isn't wrong code.
(Similarly, you can write const C x = new C; The C will be allocated on the
heap, even though it will never change afterwards).
--
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