[Issue 2082] New: Cannot convert char[] to string
BCS
ao at pathlink.com
Thu May 8 15:12:48 PDT 2008
Reply to d-bugmail at puremagic.com,
> http://d.puremagic.com/issues/show_bug.cgi?id=2082
>
> Summary: Cannot convert char[] to string
> Product: D
> Version: 2.012
> Platform: PC
> OS/Version: Linux
> Status: NEW
> Severity: normal
> Priority: P2
> Component: DMD
> AssignedTo: bugzilla at digitalmars.com
> ReportedBy: jlquinn at optonline.net
> This is really ugly. The following program:
>
> void test(char[] s) {
> string t = s;
> }
> gives the following error:
>
> junk2.d(2): Error: cannot implicitly convert expression (s) of type
> char[] to invariant(char)[]
>
> I haven't found a way around this yet. It really should be handled as
> an implicit conversion, with a copy being made under the covers as
> needed.
>
I think you need to use .idup
More information about the Digitalmars-d-bugs
mailing list