[Issue 6340] New: std.conv.to: integer to bool conversion

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 17 13:39:15 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6340

           Summary: std.conv.to: integer to bool conversion
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-07-17 13:33:59 PDT ---
import std.conv;

void main()
{
    auto x = to!bool(1);
}

D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(100): Error: template
std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) &&
isInputRange!(Unqual!(S))
&& isSomeChar!(ElementType!(S))) does not match any function template
declaration
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(100): Error: template
std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) &&
isInputRange!(Unqual!(S))
&& isSomeChar!(ElementType!(S))) cannot deduce template function from argument
types !(bool)(int)
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(100): Error: template
instance errors instantiating template
testconv.d(10): Error: template instance std.conv.to!(bool).to!(int) error
instantiating

-------------

Any special reason why this isn't implemented? Was it deemed unsafe?

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


More information about the Digitalmars-d-bugs mailing list