Implicit conversion of concatenation result to immutable

Ali Çehreli acehreli at yahoo.com
Thu Apr 1 21:45:08 UTC 2021


On 4/1/21 2:41 PM, Steven Schveighoffer wrote:

 > On 4/1/21 5:21 PM, Per Nordlöw wrote:
 >
 >> Error: cannot implicitly convert expression `x ~ cast(const(char)[])y`
 >> of type `char[]` to `string`
 >
 > That makes no sense. The compiler should allow that conversion. It can
 > clearly prove that the result doesn't derive from the parameters.
 >
 > I'm surprised it doesn't return const(char)[].
 >
 > -Steve

It should even return char[], no? Freshly copied data should belong to 
the programmer.

Ali




More information about the Digitalmars-d mailing list