Cannot pass const(T) to function with ref const(T)
Steven Schveighoffer
schveiguy at gmail.com
Sat Mar 13 23:11:45 UTC 2021
On 3/13/21 5:24 PM, Andrey wrote:
> Mistake. It says about simple argument:
>> cannot pass rvalue argument `xxxxx` of type `Word!(wstring, wstring)`
>> to parameter `ref const(Word!(wstring, wstring)) base`
>
> Function:
>> void _setPastBases(const ref Data item, const ref UsualWord base)
Yeah, D does not allow (without a switch) passing an rvalue (i.e. a
temporary) into a reference.
There is a preview switch for it, I think -preview=rvaluerefparam
-Steve
More information about the Digitalmars-d-learn
mailing list