main()1void main() 2 { 3 abstract class AbstractC{} 4 static assert(!__traits(compiles, { new AbstractC(); })); 5 6 final class FinalC{} 7 static assert(!__traits(compiles, { class D : FinalC{} })); 8 9 scope class ScopeC{} 10 static assert(!__traits(compiles, { auto sc = new ScopeC(); })); 11 static assert( __traits(compiles, { scope sc = new ScopeC(); })); 12 13 synchronized class SyncC{ void f(){} } 14 static assert(SyncC.f.mangleof[$-13..$] == "5SyncC1fMOFZv"); 15 16 @safe class SCx{ void f(){} } 17 @trusted class SCy{ void f(){} } 18 @system class SCz{ void f(){} } 19 20 static assert(SCx.f.mangleof[$-12..$] == "3SCx1fMFNfZv"); // Nf: FuncAttrSafe 21 static assert(SCy.f.mangleof[$-12..$] == "3SCy1fMFNeZv"); // Ne: FuncAttrTrusted 22 static assert(SCz.f.mangleof[$-10..$] == "3SCz1fMFZv"); // (none) 23 } 24