digitalmars.D.bugs - [Issue 6815] New: Char array is turned into string expression during constant folding
- d-bugmail puremagic.com (38/38) Oct 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6815
- d-bugmail puremagic.com (24/24) Feb 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6815
- d-bugmail puremagic.com (7/8) Feb 23 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6815
http://d.puremagic.com/issues/show_bug.cgi?id=6815 Summary: Char array is turned into string expression during constant folding Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: dawg dawgfoto.de --- Comment #0 from dawg dawgfoto.de 2011-10-15 20:35:22 PDT --- struct DChars { dchar foo() { return ary[0]; } dchar[] ary; } DChars get() { DChars s; s.ary ~= 'H'; s.ary ~= 'e'; return s; } enum dchars = get().foo(); ---- Which will bark: Error: cannot cast a read-only string literal to mutable in CTFE Cat in constfold.c turns null ~ char into a string expression even though the type of null is not a string but a char array. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 15 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6815 Denis <verylonglogin.reg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |verylonglogin.reg gmail.com --- Comment #1 from Denis <verylonglogin.reg gmail.com> 2012-02-13 14:44:03 MSK --- Probably the same issue: --- char[] f() { char[] buff = new char[1]; buff[0] = 0; // works buff.ptr[0] = 0; // works *(&buff[0]) = 0; // works char* t = &buff[0]; *t = 0; // error foreach(ref el; buff) el = 0; // error return buff; } static assert(f() == "\0"); --- Where `error` means: `Error: cannot cast a read-only string literal to mutable in CTFE` -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 13 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6815 --- Comment #2 from Don <clugdbug yahoo.com.au> 2012-02-23 02:08:29 PST --- (In reply to comment #1)Probably the same issue:Nope, completely different. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 23 2012