digitalmars.D.bugs - [Issue 9345] New: CTFE fails when using std.string.format with imported string enum
- d-bugmail puremagic.com (38/38) Jan 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9345
- d-bugmail puremagic.com (7/7) Jan 19 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9345
- d-bugmail puremagic.com (10/10) Jan 19 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9345
- d-bugmail puremagic.com (11/11) Mar 29 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9345
http://d.puremagic.com/issues/show_bug.cgi?id=9345 Summary: CTFE fails when using std.string.format with imported string enum Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: yazan.dabain gmail.com File enumfile.d --------------- module enumfile; enum Foo : string { a = "Please print me", } File main.d ----------- import enumfile; import std.stdio; //without importing std.stdio or any other package, the CTFE error disappears import std.string; void main() { pragma(msg, "%s".format(Foo.a)); } Compiler output: format.d(7): Error: cannot cast a read-only string literal to mutable in CTFE format.d(7): called from here: format("%s", "Please print me") format("%s", "Please print me") The code compiles correctly when either the import for the unrelated package is commented out, or when the enum is moved to the same file. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9345 I was looking into this again today. This problem only exists when using rdmd. Compiling using DMD v2.061 or HEAD is successful. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 19 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9345 Okay, it is the include flag. dmd -I. main.d Fails with the same output as above. BTW, the compiler output shows correctly the filename main.d and not format.d as in the first comment. I was testing locally using a file named format.d. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 19 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9345 yazan.dabain gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed on git HEAD by https://github.com/D-Programming-Language/dmd/pull/1804 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 29 2013