digitalmars.D.bugs - [Issue 21196] New: [REG 2.092] Deprecation for language feature
- d-bugmail puremagic.com (54/54) Aug 25 2020 https://issues.dlang.org/show_bug.cgi?id=21196
https://issues.dlang.org/show_bug.cgi?id=21196 Issue ID: 21196 Summary: [REG 2.092] Deprecation for language feature triggered inside of deprecated block Product: D Version: D2 Hardware: All OS: Linux Status: NEW Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: pro.mathias.lang gmail.com ``` deprecated void appendSlices ( Types ... ) ( ref void[][] slices, ref Types x ) { foreach (i, T; Types) { static if (is(T Element: Element[])) { static if (is(T == Element[])) { slices ~= (cast(void*)(&x[i]))[0 .. size_t.sizeof]; } // Append a slice to the array content. slices ~= x[i]; } else { slices ~= (cast(void*)(&x[i]))[0 .. x[i].sizeof]; } } } deprecated unittest { void[][] slices; char[] str = "Hello World!".dup; appendSlices(slices, str); } ``` Compiled with `dmd -unittest -main foo.d`: ``` Up to 2.062 : Failure with output: Error: unrecognized switch '-main' 2.063 to 2.089.1: Success and no output 2.090.1 to 2.091.1: Success with output: 1 unittests passed Since 2.092.1: Success with output: ----- onlineapp.d(9): Deprecation: copying `(cast(void*)&_param_1)[0..8]` into allocated memory escapes a reference to parameter variable `_param_1` 1 unittests passed ----- ``` --
Aug 25 2020