www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5371] New: ambiguous stringnize of class with alias this

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

           Summary: ambiguous stringnize of class with alias this
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2010-12-24 16:24:10 PST ---
We can't compile this code if enable the line:26 or line:34.
----
import std.array;
import std.format;
class C1
{
    const(string) var = "C1";
    alias var this;
}
class C2
{
    string var = "C2";
    alias var this;
}
void main()
{
    FormatSpec!char f;
    auto a = appender!string();

    auto c1 = new C1();
    auto c2 = new C2();

//  formatValue(a, c1, f);  // line:21
/*
If enable this line, 
test.d(21): Error: template std.format.formatValue(Writer,T,Char) if
(is(const(T) == const(void[]))) formatValue(Writer,T,Char) if (is(const(T) ==
const(void[])
)) matches more than one template declaration,
C:\d\dmd2\src\phobos\std\format.d(1092):formatValue(Writer,T,Char) if
(isSomeString!(T) && !isStaticArray!(T)) an
d C:\d\dmd2\src\phobos\std\format.d(1346):formatValue(Writer,T,Char) if (is(T
== class) && !isInputRange!(T))
*/

//  formatValue(a, c2, f); // line:29
/*
If enable this line,
C:\d\dmd2\src\phobos\std\format.d(1097): Error: test.C2 cannot be sliced with
[]
*/
}
----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 24 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5371



--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2010-12-24 16:25:08 PST ---
Created an attachment (id=854)
fix formatValue

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 24 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5371


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #854 is|0                           |1
           obsolete|                            |


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2010-12-24 16:40:38 PST ---
Created an attachment (id=855)
fix formatValue

I fixed patch bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 24 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5371


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

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


--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2010-12-24 16:50:04 PST ---
Fixed.

http://www.dsource.org/projects/phobos/changeset/2235

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 24 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5371


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

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


--- Comment #4 from Kenji Hara <k.hara.pg gmail.com> 2011-09-10 07:31:49 PDT ---
In dmd 2.055

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 10 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5371


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

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


--- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2011-09-10 21:15:36 PDT ---
Fixed.

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

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