Error: non-constant expression...

"Jérôme M. Berger" jeberger at free.fr
Sat Nov 27 02:51:53 PST 2010


bearophile wrote:
> Jonathan M Davis:
> 
>> At present, I don't believe that associative arrays are valid CTFE
> 
> You are wrong, the current situation with AAs is not so simple :-)
> 
> 
> string foo(string k) {
>     string[string] map = ["bar" : "spam"];
>     return map[k];
> }
> enum string v = foo("bar");
> static assert(v == "spam");
> void main() {}
> 
	He is right. Your example uses a non-static local variables which
he stated does not need to be CTFE-able.

		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20101127/fed256cb/attachment.pgp>


More information about the Digitalmars-d-learn mailing list