Bug 18940 – [std.net.curl]Can't run examples on page. cannot implicitly convert expression ... `char[]` to `string`
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-06-04T00:27:12Z
Last change time
2018-06-04T10:49:19Z
Assigned to
No Owner
Creator
Kyle Siefring
Comments
Comment #0 by kyle.siefring — 2018-06-04T00:27:12Z
import std.net.curl;
// Two requests below will do the same.
string content;
// Explicit connection provided
content = get!HTTP("dlang.org");
// Guess connection type by looking at the URL
content = get!AutoProtocol("ftp://foo.com/file");
// and since AutoProtocol is default this is the same as
content = get("ftp://foo.com/file");
// and will end up detecting FTP from the url and be the same as
content = get!FTP("ftp://foo.com/file");
get's output fails to convert to strings.
output from compiler
onlineapp.d(8): Error: cannot implicitly convert expression `get("dlang.org", opCall())` of type `char[]` to `string`
onlineapp.d(11): Error: cannot implicitly convert expression `get("ftp://foo.com/file", AutoProtocol())` of type `char[]` to `string`
onlineapp.d(13): Error: cannot implicitly convert expression `get("ftp://foo.com/file", AutoProtocol())` of type `char[]` to `string`
onlineapp.d(15): Error: cannot implicitly convert expression `get("ftp://foo.com/file", opCall())` of type `char[]` to `string`
output from programmer
loud screeching noises and expletives.