1 // REQUIRED_ARGS: -o-
2 
3 deprecated class Dep { }
4 deprecated immutable int depVar = 10;
5 
6 /*
7 TEST_OUTPUT:
8 ---
9 fail_compilation/diag14875.d(16): Deprecation: class diag14875.Dep is deprecated
10 1: Dep
11 2: Dep
12 3: Dep
13 ---
14 */
15 
16 alias X = Foo!Dep;              // deprecation
17 
Foo(T)18 template Foo(T)
19 {
20     pragma(msg, "1: ", T);      // no message
21     enum Foo = cast(void*)Bar!T;
22 }
Bar(T)23 template Bar(T)
24 {
25     pragma(msg, "2: ", T);      // no message
26     enum Bar = &Baz!T;
27 }
Baz(T)28 template Baz(T)
29 {
30     pragma(msg, "3: ", T);      // no message
31     immutable Baz = 1234;
32 }
33 
34 // ---
35 
36 /*
37 TEST_OUTPUT:
38 ---
39 fail_compilation/diag14875.d(47): Deprecation: class diag14875.Dep is deprecated
40 fail_compilation/diag14875.d(51): Deprecation: variable diag14875.depVar is deprecated
41 4: Dep
42 fail_compilation/diag14875.d(58): Deprecation: variable diag14875.depVar is deprecated
43 fail_compilation/diag14875.d(59): Deprecation: variable diag14875.Vaz!(Dep).Vaz is deprecated
44 ---
45 */
46 
47 alias Y = Voo!Dep;              // deprecation
48 
Voo(T)49 template Voo(T)
50 {
51     enum n = depVar;            // deprecation
52     struct A { alias B = T; }   // no message
53     pragma(msg, "4: ", A.B);    // B is not deprecated
54     enum Voo = cast(void*)Var!T;
55 }
Var(T)56 template Var(T)
57 {
58     enum n = depVar;            // deprecation
59     enum Var = &Vaz!T;          // deprecation
60 }
Vaz(T)61 deprecated template Vaz(T)
62 {
63     enum n = depVar;            // no message
64     immutable Vaz = 1234;
65 }
66 
67 /*
68 TEST_OUTPUT:
69 ---
70 fail_compilation/diag14875.d(75): Error: static assert  `0` is false
71 ---
72 */
main()73 void main()
74 {
75     static assert(0);
76 }
77