[Issue 8660] Unclear semantics of array literals of char type, vs string literals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 17 08:28:02 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8660



--- Comment #2 from Don <clugdbug at yahoo.com.au> 2012-09-17 08:28:43 PDT ---
(In reply to comment #1)
> I don't have a deep understanding of the DMD CTFE engine, but wouldn't it
> suffice to do a conversion to a string literal if the type is immutable(char)[]
> and to an array literal otherwise? This would only have to be done once
> (recursively on the entire return value) as a final sanitizing step after the
> CTFE execution has run to completion. This would make both lines illegal, as
> you suggest.

Yes (in fact a sanitizing step already exists, that's where pointers are
checked, for example). It wouldn't work for D1, though, which doesn't have
immutable, and for which this compiles:

char [] s = "abc";
char [] t = ['a','b','c'];

(Yuck!)

-- 
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