June 04, 2023
https://issues.dlang.org/show_bug.cgi?id=23965

          Issue ID: 23965
           Summary: [REG2.101.0] Appending deprecated structs in
                    deprecated function causes deprecation message
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P3
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: dlang-bugzilla@thecybershadow.net

Generally, deprecated code can use other deprecated code without additional messages. This allows to bulk-deprecate interdependent code in a library, making it possible to allow the library to compile with no deprecation messages, but only causing them if something (non-deprecated) accesses the deprecated declarations.

However, the following case has regressed in 2.101:

//// test.d ///
deprecated:

struct S {}

void fun()
{
    S[] arr;
    arr ~= S();
}
///////////////

Before it compiled with no errors or messages.

Now, with -de, it fails with:

/path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/appending.d(#):
Deprecation: struct `test.S` is deprecated
test.d(8):        instantiated from here: `_d_arrayappendcTXImpl!(S[], S)`
/path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/utils.d(#):
Deprecation: struct `test.S` is deprecated
/path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/appending.d(#):
       instantiated from here: `_d_HookTraceImpl!(S[], _d_arrayappendcTX,
"Cannot append to array if compiling without support for runtime type
information!")`
test.d(8):        instantiated from here: `_d_arrayappendcTXImpl!(S[], S)`

Introduced in https://github.com/dlang/dmd/pull/13495.

--