d: Merge upstream dmd, druntime 26f049fb26, phobos 330d6a4fd.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / sw_transition_complex.d
blobb6dbc8a34607c03b2a9edd76381b1c2e92b7fb13
1 // PERMUTE_ARGS:
2 // REQUIRED_ARGS: -unittest
4 /*
5 TEST_OUTPUT:
6 ---
7 compilable/sw_transition_complex.d(15): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
8 compilable/sw_transition_complex.d(16): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
9 compilable/sw_transition_complex.d(17): Deprecation: use of complex type `cfloat` is deprecated, use `std.complex.Complex!(float)` instead
10 compilable/sw_transition_complex.d(19): Deprecation: use of imaginary type `ireal` is deprecated, use `real` instead
11 compilable/sw_transition_complex.d(20): Deprecation: use of imaginary type `idouble` is deprecated, use `double` instead
12 compilable/sw_transition_complex.d(21): Deprecation: use of imaginary type `ifloat` is deprecated, use `float` instead
13 ---
15 creal c80value;
16 cdouble c64value;
17 cfloat c32value;
19 ireal i80value;
20 idouble i64value;
21 ifloat i32value;
24 TEST_OUTPUT:
25 ---
26 compilable/sw_transition_complex.d(34): Deprecation: use of complex type `creal*` is deprecated, use `std.complex.Complex!(real)` instead
27 compilable/sw_transition_complex.d(35): Deprecation: use of complex type `cdouble*` is deprecated, use `std.complex.Complex!(double)` instead
28 compilable/sw_transition_complex.d(36): Deprecation: use of complex type `cfloat*` is deprecated, use `std.complex.Complex!(float)` instead
29 compilable/sw_transition_complex.d(38): Deprecation: use of imaginary type `ireal*` is deprecated, use `real` instead
30 compilable/sw_transition_complex.d(39): Deprecation: use of imaginary type `idouble*` is deprecated, use `double` instead
31 compilable/sw_transition_complex.d(40): Deprecation: use of imaginary type `ifloat*` is deprecated, use `float` instead
32 ---
34 creal* c80pointer;
35 cdouble* c64pointer;
36 cfloat* c32pointer;
38 ireal* i80pointer;
39 idouble* i64pointer;
40 ifloat* i32pointer;
43 TEST_OUTPUT:
44 ---
45 compilable/sw_transition_complex.d(53): Deprecation: use of complex type `creal[]*` is deprecated, use `std.complex.Complex!(real)` instead
46 compilable/sw_transition_complex.d(54): Deprecation: use of complex type `cdouble[]*` is deprecated, use `std.complex.Complex!(double)` instead
47 compilable/sw_transition_complex.d(55): Deprecation: use of complex type `cfloat[]*` is deprecated, use `std.complex.Complex!(float)` instead
48 compilable/sw_transition_complex.d(57): Deprecation: use of imaginary type `ireal[]*` is deprecated, use `real` instead
49 compilable/sw_transition_complex.d(58): Deprecation: use of imaginary type `idouble[]*` is deprecated, use `double` instead
50 compilable/sw_transition_complex.d(59): Deprecation: use of imaginary type `ifloat[]*` is deprecated, use `float` instead
51 ---
53 creal[]* c80arrayp;
54 cdouble[]* d64arrayp;
55 cfloat[]* c32arrayp;
57 ireal[]* i80arrayp;
58 idouble[]* i64arrayp;
59 ifloat[]* i32arrayp;
62 TEST_OUTPUT:
63 ---
64 compilable/sw_transition_complex.d(72): Deprecation: use of complex type `creal[4][]*` is deprecated, use `std.complex.Complex!(real)` instead
65 compilable/sw_transition_complex.d(73): Deprecation: use of complex type `cdouble[4][]*` is deprecated, use `std.complex.Complex!(double)` instead
66 compilable/sw_transition_complex.d(74): Deprecation: use of complex type `cfloat[4][]*` is deprecated, use `std.complex.Complex!(float)` instead
67 compilable/sw_transition_complex.d(76): Deprecation: use of imaginary type `ireal[4][]*` is deprecated, use `real` instead
68 compilable/sw_transition_complex.d(77): Deprecation: use of imaginary type `idouble[4][]*` is deprecated, use `double` instead
69 compilable/sw_transition_complex.d(78): Deprecation: use of imaginary type `ifloat[4][]*` is deprecated, use `float` instead
70 ---
72 creal[4][]* c80sarrayp;
73 cdouble[4][]* c64sarrayp;
74 cfloat[4][]* c32sarrayp;
76 ireal[4][]* i80sarrayp;
77 idouble[4][]* i64sarrayp;
78 ifloat[4][]* i32sarrayp;
81 TEST_OUTPUT:
82 ---
83 compilable/sw_transition_complex.d(96): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
84 compilable/sw_transition_complex.d(97): Deprecation: use of complex type `creal*` is deprecated, use `std.complex.Complex!(real)` instead
85 compilable/sw_transition_complex.d(98): Deprecation: use of complex type `creal[]` is deprecated, use `std.complex.Complex!(real)` instead
86 compilable/sw_transition_complex.d(99): Deprecation: use of complex type `creal[4]` is deprecated, use `std.complex.Complex!(real)` instead
87 compilable/sw_transition_complex.d(101): Deprecation: use of imaginary type `ireal` is deprecated, use `real` instead
88 compilable/sw_transition_complex.d(102): Deprecation: use of imaginary type `ireal*` is deprecated, use `real` instead
89 compilable/sw_transition_complex.d(103): Deprecation: use of imaginary type `ireal[]` is deprecated, use `real` instead
90 compilable/sw_transition_complex.d(104): Deprecation: use of imaginary type `ireal[4]` is deprecated, use `real` instead
91 ---
93 alias C14488 = creal;
94 alias I14488 = ireal;
96 C14488 calias1;
97 C14488* calias2;
98 C14488[] calias3;
99 C14488[4] calias4;
101 I14488 ialias1;
102 I14488* ialias2;
103 I14488[] ialias3;
104 I14488[4] ialias4;
107 TEST_OUTPUT:
109 compilable/sw_transition_complex.d(115): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
110 compilable/sw_transition_complex.d(116): Deprecation: use of imaginary type `idouble` is deprecated, use `double` instead
111 compilable/sw_transition_complex.d(117): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
112 compilable/sw_transition_complex.d(118): Deprecation: use of complex type `cdouble[]` is deprecated, use `std.complex.Complex!(double)` instead
115 auto cauto = 1 + 0i;
116 auto iauto = 1i;
117 size_t c64sizeof = (cdouble).sizeof;
118 TypeInfo c64ti = typeid(cdouble[]);
121 TEST_OUTPUT:
123 compilable/sw_transition_complex.d(128): Deprecation: use of complex type `creal*` is deprecated, use `std.complex.Complex!(real)` instead
124 compilable/sw_transition_complex.d(128): Deprecation: use of imaginary type `ireal` is deprecated, use `real` instead
125 compilable/sw_transition_complex.d(132): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
128 void test14488a(creal *p, real r, ireal i)
132 creal test14488b()
134 return 1 + 0i;
137 // Forward referenced types shouldn't cause errors during test for complex or imaginary.
138 enum E;
139 struct S;
141 void test14488c(E *e, S *s)
145 // https://issues.dlang.org/show_bug.cgi?id=18212
146 // Usage of cfloat,cdouble,cfloat,ifloat,idouble,ireal shouldn't trigger an error in deprecated code
147 deprecated void test18212(creal c){}
148 deprecated unittest
150 ireal a = 2i;
151 creal b = 2 + 3i;
153 deprecated struct Foo
155 ifloat a = 2i;
156 cfloat b = 2f + 2i;
159 // https://issues.dlang.org/show_bug.cgi?id=18218
160 static assert(__traits(isDeprecated, cfloat));
161 static assert(__traits(isDeprecated, cdouble));
162 static assert(__traits(isDeprecated, creal));
163 static assert(__traits(isDeprecated, ifloat));
164 static assert(__traits(isDeprecated, idouble));
165 static assert(__traits(isDeprecated, ireal));
166 static assert(!__traits(isDeprecated, float));
167 static assert(!__traits(isDeprecated, double));
168 static assert(!__traits(isDeprecated, real));
169 static assert(!__traits(isDeprecated, int));
170 static assert(!__traits(isDeprecated, long));
171 static assert(!__traits(isDeprecated, ubyte));
172 static assert(!__traits(isDeprecated, char));
173 static assert(!__traits(isDeprecated, bool));
174 static assert(!__traits(isDeprecated, S));