[Issue 7434] Error involving array literal created in ctfe gives wrong line number

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 3 23:03:19 PST 2012


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



--- Comment #1 from yebblies <yebblies at gmail.com> 2012-02-04 18:03:18 EST ---
int[string] initHash(in string[] words) {
        int[string] h;

        for (auto i=0; i < words.length; i++) {
                h[words[i]] = i; // Compiler points to this line and says:
//Error: non-constant expression ["abc":0,"def":1,"ghi":2]
        }

        return h;
}

int[string] hash3 = initHash(["abc", "def", "ghi"]);

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