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
Comment #2 by github-bugzilla — 2013-02-16T22:25:33Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/1d24c8edf5e2ca2e9bd379a13ca75e19a2c09535 Fixes Issue 9523 - Regression: Enum to Enum conversion should work in std.conv. https://github.com/D-Programming-Language/phobos/commit/2e587acf0d6b7f0fe4b810d535db319ad9c6bed8 Merge pull request #1143 from AndrejMitrovic/Fix9523 Regression: Issue 9523 - Enum to Enum conversion should work in std.conv.to
Comment #3 by github-bugzilla — 2013-02-16T22:45:16Z
Commit pushed to staging at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/c45bdf993856981f3273dc00df0daaa9f4e67771 Merge pull request #1143 from AndrejMitrovic/Fix9523 Regression: Issue 9523 - Enum to Enum conversion should work in std.conv.to