D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15695 - Wrong error message in failed conversion from string to int
Summary: Wrong error message in failed conversion from string to int
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 minor
Assignee: No Owner
URL:
Keywords: diagnostic, pull
Depends on:
Blocks:
 
Reported: 2016-02-17 20:39 UTC by hsteoh
Modified: 2016-12-23 21:17 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description hsteoh 2016-02-17 20:39:04 UTC
Code:
------
import std.conv;
void main() {
    int i = "@12".to!int;
}
------

Output:
------
Unexpected '1' when converting from type string to type int
------

The error message should be pointing to '@' as the unexpected character, not '1'.
Comment 2 hsteoh 2016-02-17 20:50:55 UTC
And the forum thread: http://forum.dlang.org/thread/iefucpjgreyvloqegkfm@forum.dlang.org
Comment 3 github-bugzilla 2016-02-19 20:59:18 UTC
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/b57a61f45f90ed4724939a7f1f9e4eab0d3c3857
Merge pull request #4008 from quickfur/conv_errmsg

Issue 15695: wrong error message in failed conversion from string to int
Comment 4 hsteoh 2016-02-19 23:56:50 UTC
Apparently this was a duplicate of https://issues.dlang.org/show_bug.cgi?id=15215