www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23965] New: [REG2.101.0] Appending deprecated structs in

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:


Deprecation: struct `test.S` is deprecated
test.d(8):        instantiated from here: `_d_arrayappendcTXImpl!(S[], S)`

Deprecation: struct `test.S` is deprecated

       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.

--
Jun 04 2023