> void main() { > shared s1 = cast(shared)new S(); > s1.onlyShared(); // ok > //s1.notShared(); // error: not callable using argument types () shared > auto s2 = new S(); > //s2.onlyShared(); // error: not callable using argument types () > s2.notShared(); // ok > }
I would rather prefer "auto s1 = new shared(S);" because "shared s1 = new S();" seems to allocate a TLS variable which is then casted to shared which is actually non-TLS.