[Issue 6815] New: Char array is turned into string expression during constant folding
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 15 20:36:16 PDT 2011
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 at puremagic.com
ReportedBy: dawg at dawgfoto.de
--- Comment #0 from dawg at 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: -------
More information about the Digitalmars-d-bugs
mailing list