www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23140] New: Array!T where T is a shared class no longer works


          Issue ID: 23140
           Summary: Array!T where T is a shared class no longer works
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: schveiguy gmail.com

I'm not sure it should have ever worked, but I'm also wondering why this cannot
be made to work.

Prior to 2.099.0, the following code compiled:

import std.container : Array;
shared class C {}

Array!C arr;

But it no longer does. The reason is because of the fix for
https://issues.dlang.org/show_bug.cgi?id=22515. Now, a C is actually typed as
`shared(C)`, and it does not implicitly cast to `const void *` (used by GC
functions and pureFree, etc.).

Three options here:

1. Fix Array to cast away the shared when using these functions (a reasonable
2. Fix the druntime functions so they also accept `shared` pointers
3. close this bug as wontfix, and I'll have to work around it in the project
I'm trying to compile (libasync)

May 25 2022