Bug 6340 – std.conv.to: integer to bool conversion
Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-07-17T13:33:00Z
Last change time
2012-04-05T19:49:41Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-07-17T13:33:59Z
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?
Comment #1 by andrej.mitrovich — 2012-04-05T19:49:41Z