1 // PERMUTE_ARGS: 2 // POST_SCRIPT: runnable/extra-files/statictor-postscript.sh 3 4 private import std.stdio; 5 6 class Foo 7 { this()8 static this() {printf("Foo static ctor\n");} ~this()9 static ~this() {printf("Foo static dtor\n");} 10 } 11 this()12static this() {printf("static ctor\n");} ~this()13static ~this() {printf("static dtor\n");} 14 this()15shared static this() 16 { 17 printf("shared static this()\n"); 18 } 19 ~this()20shared static ~this() 21 { 22 printf("shared static this()\n"); 23 } 24 25 class Bar 26 { this()27 static this() {printf("Bar static ctor\n");} ~this()28 static ~this() {printf("Bar static dtor\n");} 29 } 30 31 /***********************************************/ 32 // 6677 33 34 int global6677; 35 this()36static this() nothrow pure @safe 37 { 38 int* p; 39 static assert(!__traits(compiles, ++p)); 40 static assert(!__traits(compiles, ++global6677)); 41 auto throwit = { throw new Exception("sup"); }; 42 static assert(!__traits(compiles, throwit() )); 43 } 44 this()45shared static this() nothrow pure @safe 46 { 47 int* p; 48 static assert(!__traits(compiles, ++p)); 49 static assert(!__traits(compiles, ++global6677)); 50 } 51 52 /***********************************************/ 53 // 7533 Foo7533(int n)54struct Foo7533(int n) 55 { 56 pure static this() { } 57 } 58 59 alias Foo7533!5 Bar7533; 60 61 /***********************************************/ 62 main()63int main() 64 { 65 return 0; 66 } 67 68