1 // PERMUTE_ARGS: 2 // REQUIRED_ARGS: -o- 3 4 /***************************************************/ 5 // 6719 6 7 static assert(__traits(compiles, mixin("(const(A))[0..0]")) == false); 8 9 /***************************************************/ 10 // 9232 11 12 struct Foo9232 13 { barFoo923214 void bar(T)() {} bazFoo923215 void baz() {} 16 } 17 test9232()18void test9232() 19 { 20 Foo9232 foo; 21 (foo).bar!int(); // OK <- Error: found '!' when expecting ';' following statement 22 ((foo)).bar!int(); // OK 23 foo.bar!int(); // OK 24 (foo).baz(); // OK 25 } 26 27 /***************************************************/ 28 // 9401 29 30 struct S9401a 31 { ~thisS9401a32 ~this() nothrow pure @safe { } 33 } 34 35 struct S9401b 36 { ~this()37 @safe ~this() pure nothrow { } 38 } 39 test9401()40void test9401() nothrow pure @safe 41 { 42 S9401a s1; 43 S9401b s2; 44 } 45 46 /***************************************************/ 47 // 9649 48 49 class Outer9649 50 { 51 class Inner 52 { 53 } 54 } 55 test9649()56void test9649() 57 { 58 Outer9649 outer9649; 59 (outer9649).new Inner(); 60 } 61 62 /***************************************************/ 63 // 9679 64 65 void test9679(inout int = 0) 66 { 67 if ( auto n = 1) { static assert(is(typeof(n) == int)); } 68 if ( const n = 1) { static assert(is(typeof(n) == const int)); } 69 if ( immutable n = 1) { static assert(is(typeof(n) == immutable int)); } 70 if (shared n = 1) { static assert(is(typeof(n) == shared int)); } 71 if (shared const n = 1) { static assert(is(typeof(n) == shared const int)); } 72 if ( inout n = 1) { static assert(is(typeof(n) == inout int)); } 73 if (shared inout n = 1) { static assert(is(typeof(n) == shared inout int)); } 74 75 if ( const int n = 1) { static assert(is(typeof(n) == const int)); } 76 if ( immutable int n = 1) { static assert(is(typeof(n) == immutable int)); } 77 if (shared int n = 1) { static assert(is(typeof(n) == shared int)); } 78 if (shared const int n = 1) { static assert(is(typeof(n) == shared const int)); } 79 if ( inout int n = 1) { static assert(is(typeof(n) == inout int)); } 80 if (shared inout int n = 1) { static assert(is(typeof(n) == shared inout int)); } 81 82 if ( const(int) n = 1) { static assert(is(typeof(n) == const int)); } 83 if ( immutable(int) n = 1) { static assert(is(typeof(n) == immutable int)); } 84 if (shared (int) n = 1) { static assert(is(typeof(n) == shared int)); } 85 if (shared const(int) n = 1) { static assert(is(typeof(n) == shared const int)); } 86 if ( inout(int) n = 1) { static assert(is(typeof(n) == inout int)); } 87 if (shared inout(int) n = 1) { static assert(is(typeof(n) == shared inout int)); } 88 89 if (immutable(int)[] n = [1]) { static assert(is(typeof(n) == immutable(int)[])); } 90 } 91 92 /***************************************************/ 93 // 9901 94 isGood9901(T)95template isGood9901(T) 96 { 97 enum isGood9901 = true; 98 } test9901()99void test9901() 100 { 101 string foo(R)(R data) if (isGood9901!R) 102 { 103 return ""; 104 } 105 foo(1); 106 } 107 108 /***************************************************/ 109 // 10199 110 test10199()111void test10199() 112 { 113 goto label; 114 label: 115 } 116 117 /***************************************************/ 118 // 12460 119 f12460(T)120void f12460(T)() 121 { 122 static if (is(T == int)) 123 { 124 goto end; 125 } 126 end: 127 } 128 test12460()129void test12460() 130 { 131 f12460!int(); 132 } 133 134 /***************************************************/ 135 // 11689 136 test11689()137void test11689() 138 { 139 deprecated void foo() {} 140 } 141 142 /***************************************************/ 143 // 11751 144 145 static assert(is(float == typeof(0x0.1p1F))); 146 147 /***************************************************/ 148 // 11957 149 150 extern(C++) class C11957 151 { x()152 void x() {} 153 } 154 test11957()155void test11957() 156 { 157 extern(C++) class D : C11957 158 { 159 override void x() {} 160 } 161 } 162 163 /***************************************************/ 164 // 13049 165 166 enum mangle13049(T) = T.mangleof; 167 alias FP13049 = void function(scope int); // OK 168 static assert(mangle13049!FP13049 == mangle13049!(void function(scope int))); // OK <- NG 169