Steven Schveighoffer <> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |
         Resolution|                            |INVALID

--- Comment #4 from Steven Schveighoffer <> 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:

If you do this:

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

Then it works as you expect.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to