Thread overview
[Issue 7628] New: Regression with std.string format and alias this
Mar 02, 2012
David
Mar 02, 2012
bioinfornatics
Mar 02, 2012
Kenji Hara
Mar 03, 2012
David
Mar 03, 2012
Kenji Hara
Mar 04, 2012
Kenji Hara
Mar 04, 2012
Kenji Hara
March 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7628

           Summary: Regression with std.string format and alias this
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: admin@dav1d.de


--- Comment #0 from David <admin@dav1d.de> 2012-03-02 06:05:48 PST ---
This code runs on ideone: http://ideone.com/iSBBO But not here, 32 bit, Linux, dmd 2.058 with:


/usr/include/d/std/conv.d(101): Error: template
std.format.formatValue(Writer,T,Char) if (is(Unqual!(T) == bool))
formatValue(Writer,T,Char) if (is(Unqual!(T) == bool)) matches more than one
template declaration,
/usr/include/d/std/format.d(1342):formatValue(Writer,T,Char) if
(!isSomeString!(T) && isDynamicArray!(T)) and
/usr/include/d/std/format.d(1978):formatValue(Writer,T,Char) if
(!isSomeString!(T) && (is(T == struct) || is(T == union)))

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7628


bioinfornatics <bioinfornatics@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bioinfornatics@gmail.com


--- Comment #1 from bioinfornatics <bioinfornatics@gmail.com> 2012-03-02 06:07:50 PST ---
I got same error as you on linux 64 with ldc2 and dmdfe 2.058

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7628



--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-02 06:22:09 PST ---
Don't link to an external site, because it may be disappear in the future. Instead write code directly, or attach the testcase, please.

> http://ideone.com/iSBBO

import std.string;
import std.stdio;

struct S {
    ubyte[] metadata;

    string toString(){
        return "%s".format( metadata );
    }
}

struct Foo {
    S[] bar;
    alias bar this;

    string toString(){
        return "%s".format( bar );
    }
}

void main(){
    S   s;
    s.metadata = [0,1,2];
    Foo foo;
    foo.bar = [s];

    writeln( foo );
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 03, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7628



--- Comment #3 from David <admin@dav1d.de> 2012-03-03 07:04:33 PST ---
https://github.com/D-Programming-Language/phobos/pull/473

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 03, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7628



--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-03 08:29:31 PST ---
This test case with 2.059head does not raise errors, but std.format still has an issue.

Reduced test case:

struct Foo {
    int[] bar;
    alias bar this;
}
void main()
{
    import std.format;
    import std.array;

    auto w = appender!string();
    FormatSpec!char f;
    Foo foo;
    formatValue(w, foo, f);    // OK
    formatValue(w, Foo(), f);  // NG
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7628



--- Comment #5 from github-bugzilla@puremagic.com 2012-03-03 18:11:56 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/9583a25fdb03a2f5187e06af6e703e03419a130f added tests for bug 7628

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7628



--- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-03 18:15:15 PST ---
Pull request: https://github.com/D-Programming-Language/phobos/pull/473

Merged commit: https://github.com/D-Programming-Language/phobos/commit/b01e60f7195336e79dbe9e0aeef2925041d7f99b

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7628


Kenji Hara <k.hara.pg@gmail.com> changed:

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7628



--- Comment #7 from github-bugzilla@puremagic.com 2012-03-08 22:54:45 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/1c1e5887b28f713ac627aa5d986f8294414e7692 added tests for bug 7628

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