Bug 17801 – Date.fromISOExtString broken in 2.076 because of changed type specifier
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-09-03T08:34:22Z
Last change time
2018-01-05T13:31:19Z
Assigned to
Jack Stouffer
Creator
Uranuz
Comments
Comment #0 by neuranuz — 2017-09-03T08:34:22Z
After upgrading to DMD 2.076 the following code was broken, because of changed type specifier:
import std.stdio;
import std.datetime;
DateTime DateTimeFromPGTimestamp( const(char)[] dateString )
{
auto temp = dateString[0..10] ~ "T" ~ dateString[11..19];
return DateTime.fromISOExtString(temp);
}
void main()
{
auto result = DateTimeFromPGTimestamp("No matter what is there!");
}
Compilation output:
/opt/compilers/dmd2/include/std/datetime/date.d(3197): Error: cannot implicitly convert expression `strip(isoExtString)` of type `const(char)[]` to `immutable(string)`
/d578/f601.d(7): Error: template instance std.datetime.date.DateTime.fromISOExtString!(char[]) error instantiating
Link to compile online:
https://dpaste.dzfl.pl/06c270576110
Comment #2 by github-bugzilla — 2017-09-05T00:54:12Z
Commits pushed to stable at https://github.com/dlang/phoboshttps://github.com/dlang/phobos/commit/80a0b584ee8d803392ab9362ee05a154370ade7d
Fix issue 17801: DateTime.fromISOExtString no longer works with const strings.
The from*String functions in std.datetime did not have tests to make
sure that they worked with various character types or various levels of
constness, and some optimizations that were done to the from*String
functions on DateTime for 2.076 broke them for const strings. So, this
adds tests for all character types and levels of constness to each of
the from*String function in std.datetime, and fixes the functionality
for DateTime that then doesn't pass the tests.
https://github.com/dlang/phobos/commit/67e66d2d4468aa3884b36dccc6d195792cab5790
Merge pull request #5721 from jmdavis/issue_17801
Fix issue 17801: DateTime.fromISOExtString no longer works with const strings.
merged-on-behalf-of: Petar Kirov <[email protected]>
Comment #3 by github-bugzilla — 2017-10-01T16:36:45Z