1 /* 2 TEST_OUTPUT: 3 --- 4 fail_compilation/parseStc5.d(10): Error: constructor cannot be static 5 fail_compilation/parseStc5.d(11): Error: postblit cannot be `static` 6 --- 7 */ 8 class C1 9 { this(int)10 static pure this(int) {} // `static pure` + `this(int)` this(this)11 static pure this(this) {} // `static pure` + `this(this)` 12 } 13 14 /* 15 TEST_OUTPUT: 16 --- 17 fail_compilation/parseStc5.d(27): Error: use `shared static this()` to declare a shared static constructor 18 fail_compilation/parseStc5.d(28): Error: use `shared static this()` to declare a shared static constructor 19 fail_compilation/parseStc5.d(30): Error: use `shared static this()` to declare a shared static constructor 20 fail_compilation/parseStc5.d(32): Error: use `shared static ~this()` to declare a shared static destructor 21 fail_compilation/parseStc5.d(33): Error: use `shared static ~this()` to declare a shared static destructor 22 fail_compilation/parseStc5.d(35): Error: use `shared static ~this()` to declare a shared static destructor 23 --- 24 */ 25 class C2 // wrong combinations of `shared`, `static`, and `~?this()` 26 { this()27 shared pure static this() {} // `shared pure` + `static this()` this()28 shared static pure this() {} // `shared static pure` + `this()` 29 this()30 static this() shared {} // `shared pure` + `static this()` 31 ~this()32 shared pure static ~this() {} // `shared pure` + `static ~this()` ~this()33 shared static pure ~this() {} // `shared static pure` + `~this()` 34 ~this()35 static ~this() shared {} // `shared` + `static ~this()` 36 } 37 38 /* 39 TEST_OUTPUT: 40 --- 41 fail_compilation/parseStc5.d(47): Error: use `static this()` to declare a static constructor 42 fail_compilation/parseStc5.d(48): Error: use `static ~this()` to declare a static destructor 43 --- 44 */ 45 class C3 // wrong combinations of `static` and `~?this()` 46 { this()47 static pure this() {} // `static pure` + `this()` ~this()48 static pure ~this() {} // `static pure` + `~this()` 49 } 50 51 /* 52 TEST_OUTPUT: 53 --- 54 fail_compilation/parseStc5.d(63): Error: redundant attribute `shared` 55 fail_compilation/parseStc5.d(64): Error: redundant attribute `shared` 56 fail_compilation/parseStc5.d(66): Error: redundant attribute `static` 57 fail_compilation/parseStc5.d(68): Error: redundant attribute `static shared` 58 fail_compilation/parseStc5.d(69): Error: redundant attribute `static shared` 59 --- 60 */ 61 class C4 // redundancy of `shared` and/or `static` 62 { this()63 shared shared static this() {} // `shared` + `shared static this()` this()64 shared static this() shared {} // `shared` + `shared static this()` 65 this()66 static static this() {} // `static` + `shared static this()` 67 this()68 shared static shared static this() {} // shared static + `shared static this()` this()69 shared static shared static this() shared {} // shared shared static + `shared static this()` 70 } 71 72 /* 73 TEST_OUTPUT: 74 --- 75 fail_compilation/parseStc5.d(83): Error: static constructor cannot be `const` 76 fail_compilation/parseStc5.d(84): Error: static destructor cannot be `const` 77 fail_compilation/parseStc5.d(85): Error: shared static constructor cannot be `const` 78 fail_compilation/parseStc5.d(86): Error: shared static destructor cannot be `const` 79 --- 80 */ 81 class C5 // wrong MemberFunctionAttributes on `shared? static (con|de)structor` 82 { this()83 static this() const {} ~this()84 static ~this() const {} this()85 shared static this() const {} ~this()86 shared static ~this() const {} 87 } 88