Debian Codegraph @

gcc/testsuite/gdc.test/compilable/dtoh_AliasDeclaration.d

raw
1 /+
2 REQUIRED_ARGS: -HC=silent -c -o- -Icompilable/extra-files
3 PERMUTE_ARGS:
4 EXTRA_FILES: extra-files/dtoh_imports.d extra-files/dtoh_imports2.d
5
6 TEST_OUTPUT:
7 ---
8 // Automatically generated by Digital Mars D Compiler
9
10 #pragma once
11
12 #include <assert.h>
13 #include <math.h>
14 #include <stddef.h>
15 #include <stdint.h>
16
17 class C;
18
19 extern void importFunc();
20
21 class ImportsC
22 {
23 };
24
25 typedef int32_t MyStdcInt;
26
27 enum
28 {
29 IgnoreErrors = 0,
30 };
31
32 typedef int32_t T;
33
34 extern "C" int32_t x;
35
36 extern "C" int32_t foo(int32_t x);
37
38 extern int32_t foo2(int32_t x);
39
40 struct S;
41
42 typedef S aliasS;
43
44 struct S2;
45
46 typedef S2 aliasS2;
47
48 typedef C* aliasC;
49
50 class C2;
51
52 typedef C2* aliasC2;
53
54 typedef size_t(*F)(size_t x);
55
56 template <typename T, typename U>
57 struct TS final
58 {
59 TS()
60 {
61 }
62 };
63
64 template <typename T, typename U>
65 using TSD = TS<T, U>;
66 typedef TSD<int32_t, int16_t > TSI;
67
68 using aliasName = ImportsC;
69
70 using MyStdc = MyStdcInt;
71
72 struct FullImport final
73 {
74 using ImportsC = ::ImportsC;
75 using MyStdcInt = ::MyStdcInt;
76 FullImport()
77 {
78 }
79 };
80
81 struct SelectiveImports final
82 {
83 using aliasName = ::ImportsC;
84 SelectiveImports()
85 {
86 }
87 };
88
89 struct PrivateImport final
90 {
91 PrivateImport()
92 {
93 }
94 };
95
96 typedef /* noreturn */ char Impossible[0];
97
98 template <typename T>
99 struct Array final
100 {
101 uint32_t length;
102 Array()
103 {
104 }
105 };
106
107 typedef Array<char > DString;
108 ---
109 +/
110
111 extern (C++):
112
113 alias T = int;
114
115 extern (C) int x;
116
117 alias u = x;
118
119 extern (C) int foo(int x)
120 {
121 return x * 42;
122 }
123
124 alias fun = foo;
125
126 extern (C++) int foo2(int x)
127 {
128 return x * 42;
129 }
130
131 alias fun2 = foo2;
132
133 extern (C) struct S;
134
135 alias aliasS = S;
136
137 extern (C++) struct S2;
138
139 alias aliasS2 = S2;
140
141 extern (C) class C;
142
143 alias aliasC = C;
144
145 extern (C++) class C2;
146
147 alias aliasC2 = C2;
148
149 alias F = size_t function (size_t x);
150
151 extern(C++) struct TS(T, U) {}
152 alias TSD = TS;
153 alias TSI = TSD!(int, short);
154
155 public import dtoh_imports :
156 importFunc,
157 aliasName = ImportsC,
158 MyStdc = MyStdcInt;
159
160 struct FullImport
161 {
162 public import dtoh_imports;
163
164 }
165
166 struct SelectiveImports
167 {
168 public import dtoh_imports :
169 importFunc,
170 aliasName = ImportsC;
171
172 public static import dtoh_imports;
173 }
174
175 struct PrivateImport
176 {
177 import dtoh_imports;
178
179 }
180
181 alias Impossible = noreturn;
182
183 struct Array(T)
184 {
185 uint length;
186 alias opDollar = length;
187 alias dim = length;
188 }
189 alias DString = Array!(char);