Bug 5168 – String enums don't work with -g compiler switch

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-11-05T06:09:00Z
Last change time
2013-02-05T13:31:56Z
Keywords
patch
Assigned to
nobody
Creator
aarti

Comments

Comment #0 by aarti — 2010-11-05T06:09:04Z
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"
Comment #1 by johannes — 2011-11-15T13:27:39Z
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; }
Comment #2 by Jesse.K.Phillips+D — 2011-11-16T09:04:05Z
*** Issue 5985 has been marked as a duplicate of this issue. ***
Comment #3 by lovelydear — 2012-04-22T02:16:52Z
Compiles and runs fine on 2.059 Win32.
Comment #4 by Jesse.K.Phillips+D — 2012-04-23T08:29:36Z
(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.
Comment #5 by lovelydear — 2012-04-23T08:55:58Z
Indeed. I overlooked the -g option. Sorry for that.
Comment #6 by simen.kjaras — 2012-07-26T14:16:09Z
*** Issue 8445 has been marked as a duplicate of this issue. ***
Comment #7 by r.sagitario — 2012-11-27T22:31:46Z
Comment #8 by github-bugzilla — 2012-11-29T04:20:26Z
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