Test case: File: main_1.d --------------------------- import std.stdio; import main_1_ext_0; void main() { writeln(Names.A); } --------------------------- File: main_1_ext_0.d --------------------------- module main_1_ext_0; enum Names : string { A = "Beauty", B = "Cinderella" } --------------------------- dmd.exe -g -IC:\DMD\DMD.2.049\\src\\phobos\ -IC:\DMD\DMD.2.049 -c main_1_ext_0.d -of.objs\main_1_ext_0.obj main_1_ext_0.d(4): Error: Integer constant expression expected instead of "Beauty" main_1_ext_0.d(5): Error: Integer constant expression expected instead of "Cinderella" main_1_ext_0.d(4): Error: Integer constant expression expected instead of "Beauty" main_1_ext_0.d(5): Error: Integer constant expression expected instead of "Cinderella"
still present on 2.056 (running on Win7 x64). however, problem happens only when enum is named. for example, the following compiles fine: enum : string { a = "a", b = "b" } int main(string[] argv) { writeln(a); return 0; } whereas the following fails: enum X : string { a = "a", // Error: Integer constant expression expected // instead of "a" b = "b" // Error: Integer constant expression expected // instead of "b" } int main(string[] argv) { writeln(X.a); return 0; }
*** Issue 5985 has been marked as a duplicate of this issue. ***
Compiles and runs fine on 2.059 Win32.
(In reply to comment #3) > Compiles and runs fine on 2.059 Win32. I'm still getting these errors test.d(4): Error: Integer constant expression expected instead of "a" when compiling the named enum version with -g option.
Indeed. I overlooked the -g option. Sorry for that.
*** Issue 8445 has been marked as a duplicate of this issue. ***
https://github.com/D-Programming-Language/dmd/pull/1331
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9f068b1b07aa9b2b3da7260ff1f5ed2615c1ae89 Merge pull request #1331 from rainers/issue_5168 fix issue 5168: do not try to generate codeview debug info for non-integer enum