| 1 |
// https://issues.dlang.org/show_bug.cgi?id=21259 |
| 2 |
// REQUIRED_ARGS: -de |
| 3 |
/* |
| 4 |
TEST_OUTPUT: |
| 5 |
--- |
| 6 |
fail_compilation/test21259.d(39): Deprecation: alias `test21259.Foo.width` is deprecated |
| 7 |
fail_compilation/test21259.d(40): Deprecation: alias `test21259.Foo2.width` is deprecated |
| 8 |
fail_compilation/test21259.d(41): Deprecation: variable `test21259.Foo3.bar` is deprecated |
| 9 |
fail_compilation/test21259.d(42): Deprecation: alias `test21259.Foo4.width` is deprecated |
| 10 |
--- |
| 11 |
*/ |
| 12 |
|
| 13 |
struct Foo |
| 14 |
{ |
| 15 |
int bar; |
| 16 |
deprecated alias width = bar; |
| 17 |
} |
| 18 |
|
| 19 |
struct Foo2 |
| 20 |
{ |
| 21 |
deprecated int bar; |
| 22 |
deprecated alias width = bar; |
| 23 |
} |
| 24 |
|
| 25 |
struct Foo3 |
| 26 |
{ |
| 27 |
deprecated int bar; |
| 28 |
} |
| 29 |
|
| 30 |
struct Foo4 |
| 31 |
{ |
| 32 |
int bar; |
| 33 |
deprecated: |
| 34 |
alias width = bar; |
| 35 |
} |
| 36 |
|
| 37 |
void main() |
| 38 |
{ |
| 39 |
Foo a = { width : 100}; |
| 40 |
Foo2 b = { width : 100}; |
| 41 |
Foo3 c = { bar : 100}; |
| 42 |
Foo4 d = { width : 100}; |
| 43 |
} |
| 44 |
|
| 45 |
// deprecations inside a deprecated scope shouldn't be triggered |
| 46 |
deprecated void test() |
| 47 |
{ |
| 48 |
Foo a = { width : 100}; |
| 49 |
Foo2 b = { width : 100}; |
| 50 |
Foo3 c = { bar : 100}; |
| 51 |
Foo4 d = { width : 100}; |
| 52 |
} |