| 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 |
|
| 18 |
template Foo(T) |
| 19 |
{ |
| 20 |
pragma(msg, "1: ", T); // no message |
| 21 |
enum Foo = cast(void*)Bar!T; |
| 22 |
} |
| 23 |
template Bar(T) |
| 24 |
{ |
| 25 |
pragma(msg, "2: ", T); // no message |
| 26 |
enum Bar = &Baz!T; |
| 27 |
} |
| 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(52): Deprecation: class `diag14875.Dep` is deprecated |
| 40 |
fail_compilation/diag14875.d(56): Deprecation: variable `diag14875.depVar` is deprecated |
| 41 |
fail_compilation/diag14875.d(52): instantiated from here: `Voo!(Dep)` |
| 42 |
4: Dep |
| 43 |
fail_compilation/diag14875.d(63): Deprecation: variable `diag14875.depVar` is deprecated |
| 44 |
fail_compilation/diag14875.d(59): instantiated from here: `Var!(Dep)` |
| 45 |
fail_compilation/diag14875.d(52): instantiated from here: `Voo!(Dep)` |
| 46 |
fail_compilation/diag14875.d(64): Deprecation: template `diag14875.Vaz(T)` is deprecated |
| 47 |
fail_compilation/diag14875.d(59): instantiated from here: `Var!(Dep)` |
| 48 |
fail_compilation/diag14875.d(52): instantiated from here: `Voo!(Dep)` |
| 49 |
--- |
| 50 |
*/ |
| 51 |
|
| 52 |
alias Y = Voo!Dep; // deprecation |
| 53 |
|
| 54 |
template Voo(T) |
| 55 |
{ |
| 56 |
enum n = depVar; // deprecation |
| 57 |
struct A { alias B = T; } // no message |
| 58 |
pragma(msg, "4: ", A.B); // B is not deprecated |
| 59 |
enum Voo = cast(void*)Var!T; |
| 60 |
} |
| 61 |
template Var(T) |
| 62 |
{ |
| 63 |
enum n = depVar; // deprecation |
| 64 |
enum Var = &Vaz!T; // deprecation |
| 65 |
} |
| 66 |
deprecated template Vaz(T) |
| 67 |
{ |
| 68 |
enum n = depVar; // no message |
| 69 |
immutable Vaz = 1234; |
| 70 |
} |
| 71 |
|
| 72 |
/* |
| 73 |
TEST_OUTPUT: |
| 74 |
--- |
| 75 |
fail_compilation/diag14875.d(80): Error: static assert: `0` is false |
| 76 |
--- |
| 77 |
*/ |
| 78 |
void main() |
| 79 |
{ |
| 80 |
static assert(0); |
| 81 |
} |