www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6340] New: std.conv.to: integer to bool conversion

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



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: -------
Jul 17 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6340


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

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



19:49:41 PDT ---
Can just use a cast, conv.to is unnecessary.

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