]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/diag13333.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / diag13333.d
1 /*
2 TEST_OUTPUT*
3 ---
4 fail_compilation/diag13333.d(29): Error: template instance VariantN!(maxSize!(S), T) recursive template expansion
5 fail_compilation/diag13333.d(29): Error: template instance diag13333.maxSize!(S) error instantiating
6 fail_compilation/diag13333.d(34): instantiated from here: Algebraic!(S)
7 ---
8 */
9
10 template maxSize(T...)
11 {
12 static if (T.length == 1)
13 {
14 enum size_t maxSize = T[0].sizeof;
15 }
16 else
17 {
18 enum size_t maxSize = T[0].sizeof >= maxSize!(T[1 .. $])
19 ? T[0].sizeof : maxSize!(T[1 .. $]);
20 }
21 }
22
23 struct VariantN(size_t maxDataSize, AllowedTypesX...)
24 {
25 }
26
27 template Algebraic(T...)
28 {
29 alias Algebraic = VariantN!(maxSize!T, T);
30 }
31
32 struct DummyScope
33 {
34 alias A = Algebraic!S;
35
36 static struct S // <- class
37 {
38 A entity;
39 }
40 }