Associative array literal is non-constant?

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Feb 3 22:18:18 PST 2012


Why does the following code give a compiler error?

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

Error message is:

	prog.d:3: Error: non-constant expression ["abc":1,"def":2,"ghi":3]

How is a literal non-constant?


T

-- 
GEEK = Gatherer of Extremely Enlightening Knowledge


More information about the Digitalmars-d-learn mailing list