Function without 'this' cannot be 'shared'
Ruby The Roobster
michaeleverestc79 at gmail.com
Sat Dec 25 19:46:20 UTC 2021
Take the following code:
void main() //Can be empty, problem occurs regardless
int test(int a) //Test function.
return 3 * a;
//Now overload it for shared...
int test(shared int a) shared
return cast(shared(int))test(cast(int)a); //Note: The
problem still happens regardless whether you have this line or
Compiling on the latest version, the compiler output you get
should be(assuming the file is named test.d):
Error: function 'test.test' without 'this' cannot be 'shared'
More information about the Digitalmars-d