2013/4/29 Sönke Ludwig <sludwig@outerproduct.org>
I noticed that the following doesn't work anymore:

---
class Test {
    this()
    {
        // ...
    }
}

void main()
{
    auto test = new shared Test; // Error: non-shared method
shared_obj.Test.this is not callable using a shared object
    //auto test cast(shared)new Text; // still works, but ugly and with
dangerous semantics
}
---

First of all, this is a new feature from 2.063 - qualified constructor support.
In the definition of the class Test, mutable constructor this() could construct only non-shared objects. Then you cannot create shared object by using it.
 
This one hurts a lot because it (again) destroys the only way to use
shared objects in a generally acceptable way (i.e. without coding
everything twice, once with "shared" and once without, and without casts
everywhere):

1. Write the class without explicit "shared" support
2. Creates shared objects where needed using "new shared ClassName"
3. Use a special "lock()" function that locks the object and safely
casts away shared during the lock

One proper way is adding shared constructor overload. Now it would be correctly selected for the construction.
class Test {
    this() {}   // for non-shared mutable construction
    this() shared {}    // for shared mutable object construction
}
new Test();   // this() is used
new shared Test();  // this() shared is used

One another way is make the constructor 'pure'. If a pure constructor satisfies some conditions, it would become to 'unique constructor'.

class Test {
    this() pure {}   // 
}
new Test();   // this() pure is used
new shared Test();  // this() pure is used!

In default, this() is used for non-shared mutable object.
But pure attribute enforces that the constructed object does not hold any "non-shared mutable global data" implicitly, then compiler can guarantee that the constructed object is unique.
Unique object can be convertible to any qualifier, then implicit conversion to shared is accepted.

Thanks.

Kenji Hara