Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string Enums doesn't work as keys for AA's #440

Closed
Kozzi11 opened this issue Aug 13, 2013 · 3 comments
Closed

string Enums doesn't work as keys for AA's #440

Kozzi11 opened this issue Aug 13, 2013 · 3 comments

Comments

@Kozzi11
Copy link

Kozzi11 commented Aug 13, 2013

module main;
import std.stdio;

enum E : string
{
A = "A",
B = "B",
C = "C",
}

void main(string[] args)
{
string[E] aa = [E.A : "a", E.B : "b", E.C : "c"];
foreach(val; aa)
{
writeln(val);
}
}

ldc output:
Error: Integer constant expression expected instead of "A"

@redstar
Copy link
Member

redstar commented Aug 16, 2013

I can reproduce it. Thanks for the report.

@redstar
Copy link
Member

redstar commented Aug 16, 2013

It looks like that we try to create an integer from an array of chars. LLVM doesn't like that. gen/typinf.cpp, line 455.

redstar added a commit that referenced this issue Aug 17, 2013
@redstar
Copy link
Member

redstar commented Aug 17, 2013

With the commit above, string enums are also accepted.

@redstar redstar closed this as completed Aug 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants