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