Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 AliasSeq!((A), (B))
5 AliasSeq!((A), (B), 0)
6 AliasSeq!((A), (B), (A))
7 AliasSeq!((A), (B), (A), (B))
8 AliasSeq!((A), (B), (A), (B))
9 AliasSeq!((A), (B), (A), (B), (A), (B), (A), (B))
10 AliasSeq!((Attr))
11 ---
12 */
13
14 // Issue 19728
15 enum A; enum B; enum Dummy = 0;
16
17 alias Seq(T...) = T;
18
19 @Seq!(A,B) struct Foo1 {}
20 @Seq!(A,B, Dummy) struct Foo2 {}
21 @Seq!(A,B,A) struct Foo3 {}
22 @Seq!(Seq!(A,B,A,B)) struct Foo4 {}
23 @Seq!(A,Seq!(B,A),B) struct Foo5 {}
24 @Seq!(A,Seq!(B,A),B) @Seq!(A,B,A,B) struct Foo6 {}
25
26 pragma(msg, __traits(getAttributes, Foo1));
27 pragma(msg, __traits(getAttributes, Foo2));
28 pragma(msg, __traits(getAttributes, Foo3));
29 pragma(msg, __traits(getAttributes, Foo4));
30 pragma(msg, __traits(getAttributes, Foo5));
31 pragma(msg, __traits(getAttributes, Foo6));
32
33 struct S(T...) {}
34 static assert(is( S!(A,B) == S!(__traits(getAttributes, Foo1))));
35 static assert(is( S!(A,B,Dummy) == S!(__traits(getAttributes, Foo2))));
36 static assert(is( S!(A,B,A) == S!(__traits(getAttributes, Foo3))));
37 static assert(is( S!(A,B,A,B) == S!(__traits(getAttributes, Foo4))));
38 static assert(is( S!(A,B,A,B) == S!(__traits(getAttributes, Foo5))));
39 static assert(is(S!(A,B,A,B,A,B,A,B) == S!(__traits(getAttributes, Foo6))));
40
41 // Issue 20093
42 mixin template MakeProperty(Attributes...) {
43 @(Attributes) void bug() {}
44 }
45
46 struct Attr { }
47
48 struct Test {
49 mixin MakeProperty!(Attr);
50 }
51
52 pragma(msg, __traits(getAttributes, Test.bug));