www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1591] New: 2.006 breaks writef("%s", str) where str is a string

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1591

           Summary: 2.006 breaks writef("%s", str) where str is a string
           Product: D
           Version: 2.006
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jemandy earthlink.net


2.006 breaks the following program:

    import std.stdio;
    void main()
    {
        // char[] str = cast(char[])("hello, world");
        string str = cast(string)("hello, world");
        writefln("%s", str);  // Breaks in 2.006
    }

This does not compile with either definition of str, the definition out version
or the active definition.  (Note, the cast is needed for the char[] definition
of str, but not the string definition of str).


-- 
Oct 17 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1591






This does NOT fail for me when using dmd 2.006 (Windows XP)

----

c:\temp>type test.d
import std.stdio;
void main()
{
string str = "hello, world";
writefln("%s", str);
}

c:\temp>dmd test.d
y:\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi;

c:\temp>test
hello, world

c:\temp>dmd
Digital Mars D Compiler v2.006
Copyright (c) 1999-2007 by Digital Mars written by Walter Bright
----


-- 
Oct 17 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1591






Oops, I had warnings enabled.  (I compile from a batch file and had forgotten
that I did this.  I should have read the error message more carefully.)  Try
again with dmd -w test.d.


-- 
Oct 17 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1591






Ok, now it fails. You could have inserted the error message into your original
report to speed up problem determination.

----
c:\temp>dmd -w test
warning - y:\dmd\bin\..\src\phobos\std\format.d(2019): Error: statement is not
reachable
y:\dmd\bin\..\src\phobos\std\format.d(2087): template instance
std.format.getNthInt!(invariant(char)[],char) error instantiating
----

(P.S. I've had to turn off -w because of problems with std.stream).


-- 
Oct 17 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1591


andrei metalanguage.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




-- 
Oct 19 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1591


andrei metalanguage.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|bugzilla digitalmars.com    |andrei metalanguage.com
             Status|ASSIGNED                    |NEW





Fixed; the fix will go into the next minor release, when the bug will be
closed. Thanks!


-- 
Oct 19 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1591


andrei metalanguage.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




-- 
Oct 19 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1591


jemandy earthlink.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED





Andrei's fix worked.


-- 
Jan 21 2008