Summary: [patch] Structs with toString and
                    isInputRange match multiple templates.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: patch
          Severity: normal
          Priority: P3
         Component: Phobos

--- Comment #0 from Rob Jacques <> 2011-06-30 11:27:03 PDT ---
If a struct defines a custom toString method and satisfies isInputRange, then
to!string(Struct) will match multiple toImpl templates. The solution is to add
an extra template constraint to the input range toImpl to detect structs with
custom toString methods.

[Line 194 in DMD 2.053]
T toImpl(T, S)(S s, in T leftBracket = "[", in T separator = ", ",
    in T rightBracket = "]")
if (isSomeString!T && !isSomeChar!(ElementType!S) &&
(isInputRange!S || isInputRange!(Unqual!S)) )

-This is the constraint to add.
&& !(is(S == struct) && is(typeof(&S.init.toString))) )

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

Reply via email to