Function without 'this' cannot be 'shared'

Adam D Ruppe destructionator at gmail.com
Sat Dec 25 20:03:49 UTC 2021


On Saturday, 25 December 2021 at 19:46:20 UTC, Ruby The Roobster 
wrote:
> int test(shared int a) shared

What do you expect that second shared to do?

Generally qualifiers after the parenthesis apply to the hidden 
`this` parameter, and since there isn't one that's why it is 
failing.

If you wanted it to apply to the return value, you write that

shared(int) test() {}

and if you wanted something else, well it depends on what you 
wanted.


More information about the Digitalmars-d mailing list