[Issue 6238] Cannot define global immutable AA

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 3 22:40:55 PST 2012


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


hsteoh at quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh at quickfur.ath.cx
           Severity|normal                      |major


--- Comment #1 from hsteoh at quickfur.ath.cx 2012-02-03 22:40:54 PST ---
It gets worse. The following doesn't compile either:

// (package scope)
auto hash = [ "abc":1, "def":2, "ghi":3 ];

Neither does this compile:

int[string] hash = [ "abc":1, "def":2, "ghi":3 ];

This happens on both dmd 2.057 (Linux) and gdc 4.6.2 (Linux).

It seems that initializing associative arrays with literals only works in
function scope. IMHO this is a major bug. It completely breaks CTFE for
associative arrays (trying to assign to an assoc array in a CTFE function
triggers the same error), and greatly limits the usefulness of having a literal
in the first place.

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