Would this be legal?class A { private static shared int counter; // shared across all instances this() { auto i = ++counter; pragma(msg, typeof(i)); // prints int } }
Yes, but it would not automatically make ++counter atomic.My proposal is simply to avoid sharing data that shouldn't be shared (i.e. stack data and temporaries), not to make all operations thread-safe.
-Steve