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


Steven Schveighoffer <schvei...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schvei...@yahoo.com
         Resolution|                            |INVALID


--- Comment #4 from Steven Schveighoffer <schvei...@yahoo.com> 2011-07-13 
12:22:48 PDT ---
Actually, I did have a D1 compiler laying around.  And I figured out the issue.

The issue is D1's type inference treats string literal types as char[N] where N
is a uint.  Note that D2's type inference treats string literals as
immutable(char)[].  So the issue is that you are not declaring a type, and D is
assuming you meant it to be a fixed-sized array.  So the literal *does* have a
zero, but it is copied into your declared fixed-sized arrays in the global
segment without the zero.

I figured it out by doing:

pragma(msg, typeof(s1).stringof);

which prints:
char[4u];

If you do this:

const string s1 = "abcd", s2 = "EFG", s3 = "h";

Then it works as you expect.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to