Pass enum variable as const ref arg

Andrey saasecondbox at yandex.ru
Fri Dec 4 12:54:25 UTC 2020


Hello,

> void test(const ref string[3] qazzz) { qazzz.writeln; }
> 
> void main()
> {
>     enum string[3] value = ["qwer", "ggg", "v"];
>     test(value);
> }

Gives errors:

> onlineapp.d(26): Error: function onlineapp.test(ref 
> const(string[3]) qazzz) is not callable using argument types 
> (string[3])
> onlineapp.d(26):        cannot pass rvalue argument ["qwer", 
> "ggg", "v"] of type string[3] to parameter ref const(string[3]) 
> qazzz

WTF?


More information about the Digitalmars-d-learn mailing list