We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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"
The text was updated successfully, but these errors were encountered:
I can reproduce it. Thanks for the report.
Sorry, something went wrong.
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.
gen/typinf.cpp
Fix for issue #440
b1160c3
With the commit above, string enums are also accepted.
No branches or pull requests
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"
The text was updated successfully, but these errors were encountered: