Most practical approach I am currently aware of is wrapping actual implementation (in most restrictive version):

class Test {

private static void foo_() {}

version (Static)
{
     static void foo() { foo_(); }
}
else
{
     void foo() { foo_(); }
}

private void bar_() shared
{
}

version (Shared)
{
    void bar() shared { bar_(); }
}
else
{
    void bar() { (cast(shared Test)this).bar_(); }
}

}

But this relies on very careful code review because of casual casts for certain attributes (static and public/private are easy in that regard)

Reply via email to