Bug 5410 – Variant.convertsTo(const(char)[]) seems broke

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-01-04T08:58:00Z
Last change time
2013-10-24T14:14:49Z
Assigned to
andrei
Creator
destructionator

Comments

Comment #0 by destructionator — 2011-01-04T08:58:05Z
Variant a; a = "10"; assert(a.convertsTo!(const(char)[])); // fails but should work This breaks coercing strings to numeric types too, since this is the test inside the coerce function.
Comment #1 by lovelydear — 2012-04-22T09:48:40Z
Also fails on 2.059 win32. For convenience: import std.stdio; import std.variant, std.conv; void main(){ Variant a; a = "10"; assert(a.convertsTo!(const(char)[])); // fails but should work }
Comment #2 by andrej.mitrovich — 2013-02-09T13:20:51Z
ImplicitConversionTargets in std.traits is to blame. That template is probably missing more though, for example I don't see 'wchar[] -> const(wchar)[]' anywhere.
Comment #3 by andrei — 2013-02-26T08:04:54Z
Comment #4 by github-bugzilla — 2013-10-24T14:14:33Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/c2c95ca9910fb2eac80af8758ec5f779dd11279b Merge pull request #1165 from andralex/5410 Fix Issue 5410 - Variant.convertsTo(const(char)[]) seems broke