www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5154] New: Class Range does not work in writeln

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

           Summary: Class Range does not work in writeln
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: Jesse.K.Phillips+D gmail.com
                CC: Jesse.K.Phillips+D gmail.com


--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D gmail.com> 2010-11-01
16:26:02 PDT ---
The code below fails to compile because a Class with InputRange primitives
sanctifies two std.format.formatValue functions. On is for printing Classes and
the other for printing an InputRange. This is not an issue when using
std.string.format (Since it doesn't use formatValue).

C:\opt\dmd\windows\bin\..\..\src\phobos\std\format.d(1455): 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
templat
e declaration,
C:\opt\dmd\windows\bin\..\..\src\phobos\std\format.d(1126):format
Value(Writer,T,Char) if (isInputRange!(T) && !isSomeChar!(ElementType!(T))) and
C:\opt\dmd\windows\bin\..\..\src\phobos\std\format.d(1297):formatValue(Writer,T,
Char) if (is(T == class))

import std.stdio;
import std.string;

class Range {
   bool empty() { return true; }
   int front() { return 1; }
   void popFront() { }
}

void main() {
   writefln("%s", new Range());
   writeln(new Range());
   writeln(format("%s", new Range()));
}

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


Shin Fujishiro <rsinfu gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |rsinfu gmail.com
         AssignedTo|nobody puremagic.com        |rsinfu gmail.com


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



--- Comment #1 from Shin Fujishiro <rsinfu gmail.com> 2010-11-16 13:03:13 PST
---
Fixed: http://www.dsource.org/projects/phobos/changeset/2170

Also fixed for interfaces and pointers to struct ranges.

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



--- Comment #2 from Shin Fujishiro <rsinfu gmail.com> 2010-11-16 13:04:06 PST
---
Fixed: http://www.dsource.org/projects/phobos/changeset/2170

Also fixed for interfaces and pointers to struct ranges.

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


Shin Fujishiro <rsinfu gmail.com> changed:

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


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