Bug 9523 – std.conv.to will no longer convert enums to themselves
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-16T20:51:00Z
Last change time
2013-02-16T22:45:16Z
Keywords
pull
Assigned to
andrej.mitrovich
Creator
issues.dlang
Comments
Comment #0 by issues.dlang — 2013-02-16T20:51:30Z
This compiled with 2.061
import std.conv;
enum E { a }
void main()
{
auto month2 = to!E(E.a);
}
but does not compile with the current beta for 2.062. Rather, it gives the error:
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/conv.d(274): Error: template std.conv.toImpl matches more than one template declaration, /home/jmdavis/dmd2/linux/bin/../../src/phobos/std/conv.d(330):toImpl(T, S)(S value) if (isImplicitlyConvertible!(S, T) && !isEnumStrToStr!(S, T) && !isNullToStr!(S, T)) and /home/jmdavis/dmd2/linux/bin/../../src/phobos/std/conv.d(1654):toImpl(T, S)(S value) if (is(T == enum) && is(S : OriginalType!(T)) && !isFloatingPoint!(OriginalType!(T)) && !isSomeString!(OriginalType!(T)))
q.d(7): Error: template instance std.conv.to!(E).to!(E) error instantiating
Comment #1 by andrej.mitrovich — 2013-02-16T20:56:51Z